public void AddComponent(string key, Type serviceType, Type classType, LifestyleType lifestyle, bool overwriteLifestyle)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }
            if (classType == null)
            {
                throw new ArgumentNullException("classType");
            }
            if (LifestyleType.Undefined == lifestyle)
            {
                throw new ArgumentException("The specified lifestyle must be Thread, Transient, or Singleton.", "lifestyle");
            }
            var model = ComponentModelFactory.BuildModel(new ComponentName(key, true), new[] { serviceType }, classType, null);

            if (overwriteLifestyle || LifestyleType.Undefined == model.LifestyleType)
            {
                model.LifestyleType = lifestyle;
            }

            RaiseComponentModelCreated(model);

            var handler = HandlerFactory.Create(model);

            RegisterHandler(key, handler);
        }
        public virtual void AddComponentWithExtendedProperties(String key, Type serviceType, Type classType, IDictionary extendedProperties)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (extendedProperties == null)
            {
                throw new ArgumentNullException("extendedProperties");
            }
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }
            if (classType == null)
            {
                throw new ArgumentNullException("classType");
            }

            var model = ComponentModelFactory.BuildModel(new ComponentName(key, true), new[] { serviceType }, classType, extendedProperties);

            RaiseComponentModelCreated(model);
            var handler = HandlerFactory.Create(model);

            RegisterHandler(key, handler);
        }
Example #3
0
 public HeroComponentApiController(SharePointConfiguration spConfiguration)
 {
     _spConfiguration = spConfiguration;
     _modelFactory    = new ComponentModelFactory();
 }