示例#1
0
 public static void Execute(RequestModel request, out ResponseModel response)
 {
     response = new ResponseModel();
     if (FunctionRegisted.ContainsKey(request.Function))
     {
         BaseFunction function =
             (BaseFunction)Activator.CreateInstance(FunctionRegisted[request.Function]);
         function.Initialize(request);
         function.Execute();
         function.GetResponse(out response);
     }
 }
示例#2
0
        //public static Dictionary<string, RouteInfo> RouteRegistered { get; private set; } = new Dictionary<string, RouteInfo>();

        public static void RegisterFunctions()
        {
            Assembly    assembly      = Assembly.GetExecutingAssembly();
            List <Type> listFunctions =
                assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(BaseFunction))).ToList();

            foreach (Type type in listFunctions)
            {
                string key = Regex.Replace(type.Name, @"(Function)\z", string.Empty);
                FunctionRegisted.Add(key, type);
                //LogController.LogInfo(string.Format(ResourceEnum.FunctionLoaded, name));
            }
        }