Exemplo n.º 1
0
        public virtual FastContainerRegistration Register(Type type, Func <FastContainer, object> resolve)
        {
            AssertNotDisposed();
            if (SupperLogging)
            {
                Logger.Debug("Registering Wireup Callback for {0}", type);
            }
            var registration = new FastContainerRegistration(c => (object)resolve(c));

            this.registrations[type] = registration;
            return(registration);
        }
Exemplo n.º 2
0
        public virtual FastContainerRegistration Register <TService>(Func <FastContainer, TService> resolve)
            where TService : class
        {
            AssertNotDisposed();
            if (SupperLogging)
            {
                Logger.Debug("Registering Wireup Callback for {0}", typeof(TService));
            }
            var registration = new FastContainerRegistration(c => (object)resolve(c));

            this.registrations[typeof(TService)] = registration;
            return(registration);
        }
Exemplo n.º 3
0
        public virtual FastContainerRegistration Register(Type type, object instance)
        {
            AssertNotDisposed();
            if (Equals(instance, null))
            {
                throw new ArgumentNullException("instance", "Instance Cannot Be Null");
            }

            if (type.IsValueType && type.IsInterface)
            {
                throw new ArgumentException("Type Must Be Interface", "instance");
            }

            if (SupperLogging)
            {
                Logger.Debug("Registering Service Instance {0}", type);
            }
            var registration = new FastContainerRegistration(instance);

            this.registrations[type] = registration;
            return(registration);
        }
 private FastContainerRegistration(FastContainerRegistration other)
 {
     this.resolve         = other.resolve;
     this.instancePerCall = other.instancePerCall;
     this.instance        = other.instance;
 }
 private FastContainerRegistration(FastContainerRegistration other)
 {
     this.resolve = other.resolve;
     this.instancePerCall = other.instancePerCall;
     this.instance = other.instance;
 }