Example #1
0
        public virtual FastContainerRegistration Register(Type type, Func <FastContainer, object> resolve)
        {
            AssertNotDisposed();
            var registration = new FastContainerRegistration(c => (object)resolve(c));

            this.registrations[type] = registration;
            return(registration);
        }
Example #2
0
        public virtual FastContainerRegistration Register <TService>(Func <FastContainer, TService> resolve)
            where TService : class
        {
            AssertNotDisposed();
            var registration = new FastContainerRegistration(c => (object)resolve(c));

            this.registrations[typeof(TService)] = registration;
            return(registration);
        }
Example #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");
            }

            var registration = new FastContainerRegistration(instance);

            this.registrations[type] = registration;
            return(registration);
        }
Example #4
0
 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;
 }