Page 1 of 1

Custom referenced assembly not recognized in mvc core.

Posted: Fri Feb 01, 2019 12:52 am
by alireza_s_84
Hi
I add current assembly to report ReferencedAssemblies as below:

Code: Select all

var list = report.ReferencedAssemblies.ToList();
list.Add("StimulTest.dll");
report.ReferencedAssemblies = list.ToArray();
Then use in report like this:

Code: Select all

{StimulTest.DateHelper.ToPersian(Today)}
But this not work.
Are Mvc core support custom ReferencedAssemblies?

Re: Custom referenced assembly not recognized in mvc core.

Posted: Fri Feb 01, 2019 9:51 pm
by Lech Kulikowski
Hello,

Unfortunately, it is not supported. In the NET Core is available only Interpretation mode.

Thank you.

Re: Custom referenced assembly not recognized in mvc core.

Posted: Fri Feb 01, 2019 10:18 pm
by alireza_s_84
Lech Kulikowski wrote: Fri Feb 01, 2019 9:51 pm Hello,

Unfortunately, it is not supported. In the NET Core is available only Interpretation mode.

Thank you.
Thanks for reply, I want to use a custom function for convert date there is any way for that?

Re: Custom referenced assembly not recognized in mvc core.

Posted: Sat Feb 02, 2019 9:16 am
by Lech Kulikowski
Hello,

You can add necessary functions in the Dictionary of the designer.

Thank you.

Re: Custom referenced assembly not recognized in mvc core.

Posted: Sat Feb 02, 2019 4:52 pm
by alireza_s_84
Lech Kulikowski wrote: Sat Feb 02, 2019 9:16 am Hello,

You can add necessary functions in the Dictionary of the designer.

Thank you.
I add functions as below:

Code: Select all

namespace DoctorCode.AspNetCore.Reports
{
    public static class Test
    {
        public static string Print()
        {
            return "Alireza";
        }
    }

    public static class PersianDateTimeHelper
    {
        public static void RegisterFanctions()
        {
            var types = new[]
            {
                new
                {
                    Type = typeof(PersianDateTime),
                    Category = "PersianCulture",
                    GroupFunctionName = "DateTime"
                },

                new
                {
                    Type = typeof(Test),
                    Category = "Test",
                    GroupFunctionName = ""
                },
            };

            foreach (var item in types)
            {
                item.Type.RegisterFanctions(item.Category, item.GroupFunctionName);
            }
        }

        private static void RegisterFanctions(this Type type, string category, string groupFunctionName)
        {
            var methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
            foreach (var method in methods)
            {
                StiFunctions.AddFunction(
                    category: category,
                    groupFunctionName: groupFunctionName,
                    functionName: method.Name,
                    description: "",
                    typeOfFunction: type,
                    returnType: method.ReturnType,
                    returnDescription: "",
                    argumentTypes: method.GetParameters().Select(p => p.ParameterType).ToArray(),
                    argumentNames: method.GetParameters().Select(p => p.Name).ToArray(),
                    argumentDescriptions: new string[0]);
            }
        }
    }
}
All functions are registered and display in Dictionary but functions from external assembly (typeof(PersianDateTime)) not work but typeof(Test) work.
It is necessary to define the type in the current assembly???

Re: Custom referenced assembly not recognized in mvc core.

Posted: Sat Feb 02, 2019 5:11 pm
by alireza_s_84
alireza_s_84 wrote: Sat Feb 02, 2019 4:52 pm
Lech Kulikowski wrote: Sat Feb 02, 2019 9:16 am Hello,

You can add necessary functions in the Dictionary of the designer.

Thank you.
I add functions as below:
All functions are registered and display in Dictionary but functions from external assembly (typeof(PersianDateTime)) not work but typeof(Test) work.
It is necessary to define the type in the current assembly???

Code: Select all

using System;

namespace DoctorCode.Globalization
{
    public static class PersianDateTime
    {
        public static string Now()
        {
            return Now("G");
        }

        public static string Now(string format)
        {
            if (string.IsNullOrEmpty(format))
            {
                throw new ArgumentException(nameof(format));
            }

            using (CultureHelper.NewPersian())
            {
                return DateTime.Now.ToString(format);
            }
        }

        public static string Today()
        {
            using (CultureHelper.NewPersian())
            {
                return DateTime.Now.ToString("yyyy/MM/dd");
            }
        }

        public static string Today(string format)
        {
            if (string.IsNullOrEmpty(format))
            {
                throw new ArgumentException(nameof(format));
            }

            using (CultureHelper.NewPersian())
            {
                return DateTime.Now.ToString(format);
            }
        }

        public static string ToShortDateString(DateTime date)
        {
            using (CultureHelper.NewPersian())
            {
                return date.ToShortDateString();
            }
        }

        public static string ToLongDateString(DateTime date)
        {
            using (CultureHelper.NewPersian())
            {
                return date.ToLongDateString();
            }
        }

        public static string ToShortTimeString(DateTime date)
        {
            using (CultureHelper.NewPersian())
            {
                return date.ToShortTimeString();
            }
        }

        public static string ToLongTimeString(DateTime date)
        {
            using (CultureHelper.NewPersian())
            {
                return date.ToLongTimeString();
            }
        }

        public static string Format(DateTime date, string format)
        {
            using (CultureHelper.NewPersian())
            {
                return date.ToString(format);
            }
        }

    }
}
If we have methods with same name and different parameters and call this method not work.

Re: Custom referenced assembly not recognized in mvc core.

Posted: Sun Feb 03, 2019 12:23 pm
by Lech Kulikowski
Hello,

Please send us a sample project which reproduces the issue for analysis on support@stimulsoft.com

Thank you.

Re: Custom referenced assembly not recognized in mvc core.

Posted: Tue Nov 26, 2019 1:58 am
by duc.buingoc89
Hello,

I have same proplem

Please see my attached file and help me solve this problem

Thank you.

Re: Custom referenced assembly not recognized in mvc core.

Posted: Thu Nov 28, 2019 10:30 pm
by Lech Kulikowski
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.