/// <summary>
        /// Initialize functions from assembly
        /// </summary>
        public static void InitializeFunctions(IFunctionReader functionReader, Type rootTypeForSearching, bool replace = false)
        {
            var funcInterfaceType = typeof(IFunction);

            var types         = rootTypeForSearching.Assembly.GetTypes();
            var filteredTypes = types
                                .Where(w => w.IsClass)
                                .Where(w => !w.IsAbstract)
                                .Where(w => funcInterfaceType.IsAssignableFrom(w))
                                .ToArray();

            for (int i = 0; i < filteredTypes.Length; i++)
            {
                var func = (IFunction)Activator.CreateInstance(filteredTypes[i]);
                functionReader.AddFunction(func, replace);
            }
        }
Exemplo n.º 2
0
        private void InjectUserDefinedFunctions()
        {
            IFunctionReader functionReader = (IFunctionReader)Kernel !.GetService(typeof(IFunctionReader));

            NoStringFunctionsInitializer.InitializeFunctions(functionReader, typeof(NoStringNinjectModule));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Parser from string to object sequence
 /// </summary>
 public FormulaParser(IFunctionReader functionReader)
 {
     FunctionsReader = functionReader;
 }