Beispiel #1
0
        internal void CacheCreator(Type restController)
        {
            if (!_cache.ContainsKey(restController))
            {
                var restControllerAtt  = restController.GetTypeInfo().GetCustomAttribute <RestControllerAttribute>();
                InstanceCreationType t = restControllerAtt != null ? restControllerAtt.InstanceCreationType : InstanceCreationType.Singleton;

                if (t == InstanceCreationType.PerCall)
                {
                    _cache[restController] = new PerCallInstanceCreator();
                }
                else
                {
                    _cache[restController] = new SingletonInstanceCreator();
                }
            }
        }
 public RestControllerAttribute(InstanceCreationType instanceCreation)
 {
     InstanceCreationType = instanceCreation;
 }
Beispiel #3
0
 public RestControllerAttribute(InstanceCreationType instanceCreation)
 {
     InstanceCreationType = instanceCreation;
 }