public static ComponentRegistration <TProjection> AsProjection <TProjection>(
     this ComponentRegistration <TProjection> registration,
     string hostingBoundContext,
     string projectedBoundContext,
     int batchSize             = 0,
     int applyTimeoutInSeconds = 0)
     where TProjection : class
 {
     return(registration.ExtendedProperties(new
     {
         IsProjection = true,
         ProjectedBoundContext = projectedBoundContext,
         BoundContext = hostingBoundContext,
         BatchSize = batchSize,
         ApplyTimeoutInSeconds = applyTimeoutInSeconds,
         BeforeBatchApply = (Func <object, object>)null,
         AfterBatchApply = (Action <object, object>)null,
         BatchContextType = (Type)null
     }));
 }
Exemplo n.º 2
0
        /// <summary>
        ///   Creates a component registration for the <paramref name = "serviceTypes" />
        /// </summary>
        /// <param name = "serviceTypes">Types of the service.</param>
        /// <returns>The component registration.</returns>
        /// B
        public static ComponentRegistration For(IEnumerable <Type> serviceTypes)
        {
            ComponentRegistration registration = null;

            foreach (var serviceType in serviceTypes)
            {
                if (registration == null)
                {
                    registration = For(serviceType);
                }
                else
                {
                    registration.Forward(serviceType);
                }
            }

            if (registration == null)
            {
                throw new ArgumentException("At least one service type must be supplied");
            }

            return(registration);
        }
 public static ComponentRegistration <TService> LifestylePerWebRequest <TService>(this ComponentRegistration <TService> registration) where TService : class
 {
     return(registration.LifeStyle.Scoped <WebRequestScopeAccessor>());
 }
Exemplo n.º 4
0
        public static DecorationRegistration <ComponentRegistration <TService>, TService> Decorated <TService>(this ComponentRegistration <TService> extended)
            where TService : class
        {
            var extensions = extended.GetResolveExtensions();
            var decoratorResolveExtension2 = extensions.Get <DecoratorApplier>();
            var result = new DecorationRegistration <ComponentRegistration <TService>, TService>(extended, decoratorResolveExtension2);

            return(result);
        }
Exemplo n.º 5
0
 public RegistrationGroup(ComponentRegistration <S> registration)
 {
     this.registration = registration;
 }
 /// <see cref="PerWebSession{S}"/>
 public static ComponentRegistration <TService> LifestylePerWebSession <TService>(this ComponentRegistration <TService> registration)
     where TService : class =>
 registration.LifeStyle.PerWebSession();
 /// <see cref="HybridPerWebRequestPerThread{S}"/>
 public static ComponentRegistration <TService> LifestyleHybridPerWebRequestPerThread <TService>(this ComponentRegistration <TService> registration)
     where TService : class =>
 registration.LifeStyle.HybridPerWebRequestPerThread();