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); }
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); }
public static bool IsSet(this ControllerFlags flags, ControllerFlags flag) { return (flags & flag) != 0; }
public static bool IsSet(this ControllerFlags flags, ControllerFlags flag) { return((flags & flag) != 0); }