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