Ejemplo n.º 1
0
        private static ILifetimePolicy GetLifetimePolicy(IBuilderContext context)
        {
            ILifetimePolicy policy = context.Policies.Get <ILifetimePolicy>(context.BuildKey);

            if (policy == null)
            {
                policy = new TransientLifetimePolicy();
                context.PersistentPolicies.Set <ILifetimePolicy>(policy, context.BuildKey);
            }
            return(policy);
        }
Ejemplo n.º 2
0
        private static ILifetimePolicy GetLifetimePolicy(IBuilderContext context)
        {
            ILifetimePolicy policy = context.Policies.GetNoDefault<ILifetimePolicy>(context.BuildKey, false);
            if(policy == null && BuildKey.GetType(context.BuildKey).IsGenericType)
            {
                policy = GetLifetimePolicyForGenericType(context);
            }

            if(policy == null)
            {
                policy = new TransientLifetimePolicy();
                context.PersistentPolicies.Set<ILifetimePolicy>(policy, context.BuildKey);
            }
            return policy;
        }
Ejemplo n.º 3
0
        private static ILifetimePolicy GetLifetimePolicy(IBuilderContext context)
        {
            ILifetimePolicy policy = context.Policies.GetNoDefault <ILifetimePolicy>(context.BuildKey, false);

            if (policy == null && BuildKey.GetType(context.BuildKey).IsGenericType)
            {
                policy = GetLifetimePolicyForGenericType(context);
            }

            if (policy == null)
            {
                policy = new TransientLifetimePolicy();
                context.PersistentPolicies.Set <ILifetimePolicy>(policy, context.BuildKey);
            }
            return(policy);
        }