Exemple #1
0
 public static IView GetView(MODELS model)
 {
     if (ViewsMap.ContainsKey(model) == false)
     {
         InitializeView(model);
     }
     return((IView)Activator.CreateInstance(ViewsMap[model]));
 }
Exemple #2
0
 private static object GetEntity(MODELS model)
 {
     if (EntityMap.ContainsKey(model) == false)
     {
         InitializeTypesMap(model);
     }
     return(EntityMap[model]);
 }
 public static IController GetController(MODELS model)
 {
     if (ControllerMap.ContainsKey(model) == false)
     {
         InitializeTypesMap(model);
     }
     return(ControllerMap[model]);
 }
        private static void InitializeTypesMap(MODELS model)
        {
            var type = Assembly
                       .GetExecutingAssembly()
                       .GetTypes()
                       .Where(x => x.Name.Equals($"{model}Controller"))
                       .FirstOrDefault();

            ControllerTypes[type.Name] = type;
            ControllerMap[model]       = (IController)Activator.CreateInstance(type);
        }
Exemple #5
0
        private static void InitializeTypesMap(MODELS model)
        {
            var type = Assembly
                       .GetExecutingAssembly()
                       .GetTypes()
                       .Where(x => x.Name.Equals($"{model}Entity"))
                       .FirstOrDefault();

            EntityTypes[type.Name] = type;
            EntityMap[model]       = Activator.CreateInstance(type);
            //this should be disabled after go-live
            //Console.WriteLine(EntityMap[model].GetType().GetMethod("GetDDL").Invoke(EntityMap[model], null));
        }
Exemple #6
0
        private static void InitializeView(MODELS model)
        {
            var view = Assembly
                       .GetExecutingAssembly()
                       .GetTypes()
                       .Where(x => x.Name.Equals($"{model}Form"))
                       .FirstOrDefault();

            if (view != null)
            {
                if (Enum.TryParse(view.Name.Substring(0, (view.Name.Length) - ("Form".Length)), out MODELS num))
                {
                    ViewsMap[num] = view;
                    Console.WriteLine($" + [View] : {num}:{view}");
                }
                else
                {
                    throw new Exception($"no Enum was defined for {view}");
                }
            }
        }
Exemple #7
0
 public List <Type> this[MODELS controllersEnum] {
     get {
         return(ControllersMap[controllersEnum]);
     }
 }
 public static string FK(MODELS models, int id)
 {
     return(GetController(models).GetValues(id));
 }
 public static string FK(MODELS models, string id) => FK(models, id.ToInteger());
Exemple #10
0
 public async Task <ActionResult <string> > GetVM(MODELS vm)
 {
     return("this is test and");
 }