public BaseApiController(string connectionKey, string serviceType) { switch (serviceType) { case "ado": _typeSrv = new DBService <T, IdType>(connectionKey); break; case "ef": _typeSrv = new EFDBService <T, IdType>(connectionKey); break; default: _typeSrv = new EFDBService <T, IdType>(connectionKey); break; } var dic = new Dictionary <string, Dictionary <Type, object[]> >(); foreach (var method in GetType().GetMethods(System.Reflection.BindingFlags.Public)) { dic.Add(method.Name, new Dictionary <Type, object[]>() { { typeof(RouteAttribute), new[] { typeof(T).Name + "/{action}" } } }); } this.AddOrSetAttribute(dic); }
public BaseApiController() { _typeSrv = new EFDBService <T, IdType>(); var dic = new Dictionary <string, Dictionary <Type, object[]> >(); foreach (var method in GetType().GetMethods(System.Reflection.BindingFlags.Public)) { dic.Add(method.Name, new Dictionary <Type, object[]>() { { typeof(RouteAttribute), new[] { typeof(T).Name + "/{action}" } } }); } this.AddOrSetAttribute(dic); }