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; }