コード例 #1
0
ファイル: ApiConfiguration.cs プロジェクト: kouweizhong/vita
 public ApiControllerInfo(object instance, Type type, string routePrefix = null)
 {
     Instance = instance;
     if (type == null && instance != null)
     {
         type = instance.GetType();
     }
     TypeInfo    = type.GetTypeInfo();
     RoutePrefix = routePrefix;
     //Prefix
     if (RoutePrefix == null)
     {
         var prefAttr = TypeInfo.GetAttribute <ApiRoutePrefixAttribute>();
         if (prefAttr != null)
         {
             RoutePrefix = prefAttr.Prefix;
         }
     }
     if (TypeInfo.HasAttribute <LoggedInOnlyAttribute>())
     {
         Flags |= ControllerFlags.LoggedInOnly;
     }
     //Secured
     if (TypeInfo.HasAttribute <SecuredAttribute>())
     {
         Flags |= ControllerFlags.Secured;
     }
     ApiGroup = GetApiGroup(TypeInfo);
 }
コード例 #2
0
ファイル: ApiConfiguration.cs プロジェクト: yuanfei05/vita
 public ApiControllerInfo(object instance, Type type, string routePrefix = null)
 {
     Instance = instance;
       Type = type;
       if(Type == null && Instance != null)
     Type = Instance.GetType();
       RoutePrefix = routePrefix;
       //Prefix
       if(RoutePrefix == null) {
     var prefAttr = Type.GetAttribute<ApiRoutePrefixAttribute>();
     if(prefAttr != null)
       RoutePrefix = prefAttr.Prefix;
       }
       if (type.HasAttribute<LoggedInOnlyAttribute>())
     Flags |= ControllerFlags.LoggedInOnly;
      //Secured
       if (type.HasAttribute<SecuredAttribute>())
     Flags |= ControllerFlags.Secured;
       ApiGroup = GetApiGroup(Type);
 }
コード例 #3
0
ファイル: ApiConfiguration.cs プロジェクト: yuanfei05/vita
 public static bool IsSet(this ControllerFlags flags, ControllerFlags flag)
 {
     return (flags & flag) != 0;
 }
コード例 #4
0
ファイル: ApiConfiguration.cs プロジェクト: kouweizhong/vita
 public static bool IsSet(this ControllerFlags flags, ControllerFlags flag)
 {
     return((flags & flag) != 0);
 }