Пример #1
0
        public ReactFunctionInfo(FieldInfo fieldInfo, ReactFunctionAttribute functionAttribute, string moduleName)
        {
            var functionName = functionAttribute.FunctionName ?? fieldInfo.Name;

            moduleName = functionAttribute.ModuleName ?? moduleName;
            var functionArgTypes = GetFunctionArgTypes(fieldInfo.FieldType,
                                                       formatError: message => $"{message} Module: {fieldInfo.DeclaringType.Name}, Field: {fieldInfo.Name}");

            FunctionImpl = new Lazy <ReactFunctionImpl>(() =>
                                                        MakeFunction(fieldInfo, moduleName, functionName, functionArgTypes), LazyThreadSafetyMode.PublicationOnly);
        }
Пример #2
0
        public ReactFunctionInfo(PropertyInfo propertyInfo, ReactFunctionAttribute functionAttribute, string moduleName)
        {
            var functionName = functionAttribute.FunctionName ?? propertyInfo.Name;

            moduleName = functionAttribute.ModuleName ?? moduleName;
            var functionArgTypes = GetFunctionArgTypes(propertyInfo.PropertyType,
                                                       formatError: message => $"{message} Module: {propertyInfo.DeclaringType.Name}, Property: {propertyInfo.Name}");

            FunctionImpl = new Lazy <ReactFunctionImpl>(() =>
                                                        MakeFunction(propertyInfo, moduleName, functionName, functionArgTypes), LazyThreadSafetyMode.PublicationOnly);
        }