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

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

            this.registrations[typeof(TService)] = registration;
            return(registration);
        }
        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.IsDebugEnabled)
            {
                Logger.DebugFormat("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;
 }
Exemple #5
0
 private FastContainerRegistration(FastContainerRegistration other)
 {
     this.resolve         = other.resolve;
     this.instancePerCall = other.instancePerCall;
     this.instance        = other.instance;
 }