public static IView GetView(MODELS model) { if (ViewsMap.ContainsKey(model) == false) { InitializeView(model); } return((IView)Activator.CreateInstance(ViewsMap[model])); }
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); }
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)); }
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}"); } } }
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());
public async Task <ActionResult <string> > GetVM(MODELS vm) { return("this is test and"); }