Esempio n. 1
0
        private string GetLifetimeManager(ContainerRegistration registration)
        {
            switch (registration.Lifetime)
            {
            case Constants.ContainerRegistrationEvent.SingletonLifetime:
                return("new ContainerControlledLifetimeManager()");

            case Constants.ContainerRegistrationEvent.PerServiceCallLifetime:
                return($"new {Project.Application.FindTemplateInstance<IHasClassDetails>(TemplateDependancy.OnTemplate(PerServiceCallLifetimeManagerTemplate.Identifier)).ClassName}()");

            case Constants.ContainerRegistrationEvent.TransientLifetime:
                return(string.Empty);

            default:
                return(string.Empty);
            }
        }
Esempio n. 2
0
 private string GetRegistrationString(ContainerRegistration x)
 {
     return(x.InterfaceType != null
         ? $"{Environment.NewLine}            container.RegisterType<{NormalizeNamespace(x.InterfaceType)}, {NormalizeNamespace(x.ConcreteType)}>({GetLifetimeManager(x)});"
         : $"{Environment.NewLine}            container.RegisterType<{NormalizeNamespace(x.ConcreteType)}>({GetLifetimeManager(x)});");
 }