示例#1
0
文件: IoCHelper.cs 项目: zce/micua
 public static void InitializeWith(IDependencyResolverFactory factory)
 {
     if (_resolver == null)
     {
         _resolver = factory.CreateInstance();
     }
 }
示例#2
0
        public static void InitializeWith(IDependencyResolverFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }

            _resolver = factory.CreateInstance();
        }
示例#3
0
 /// <summary>
 ///     Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 /// <filterpriority>2</filterpriority>
 public static void Dispose()
 {
     lock (SetLocker)
     {
         _isInited = false;
         _resolver = null;
         _dependencyResolverFactory = null;
     }
 }
示例#4
0
        private static void ConfigureDependencyResolvers(HttpConfiguration config, IDependencyResolverFactory factory)
        {
            if (config == null) throw new ArgumentNullException("config");
            if (factory == null) throw new ArgumentNullException("factory");

            //Web API resolver
            config.DependencyResolver = factory.CreateApiResolver();

            //MVC resolver
            DependencyResolver.SetResolver(factory.CreateMvcResolver());
        }
示例#5
0
        /// <summary>
        ///     Initialize resolver factory
        /// </summary>
        /// <param name="resolverFactory"></param>
        private static void InitResolverFactory(IDependencyResolverFactory resolverFactory)
        {
            lock (SetLocker)
            {
                _dependencyResolverFactory = resolverFactory;
                _dependencyResolverFactory.CreateResolver();
                _resolver = _dependencyResolverFactory.GetResolver();
                _isInited = true;
            }

            Log.Info(String.Format("Configuration complete. DependencyResolverFactory is: {0}", _resolver));
        }
示例#6
0
        /// <summary>
        ///     Configure dependency resolver implementation
        /// </summary>
        /// <param name="resolverFactory"> </param>
        /// <exception cref="NullReferenceException">Resolver factory  can't be null</exception>
        /// <exception cref="InvalidOperationException">DependencyResolver all ready configured</exception>
        public static void ConfigureResolver(IDependencyResolverFactory resolverFactory)
        {
            if (resolverFactory == null)
            {
                throw new NullReferenceException("Resolver factory can't be null");
            }

            if (_isInited)
            {
                throw new InvalidOperationException("DependencyResolver allready configured");
            }

            InitResolverFactory(resolverFactory);
        }
示例#7
0
        private static void ConfigureDependencyResolvers(HttpConfiguration config, IDependencyResolverFactory factory)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }

            //Web API resolver
            config.DependencyResolver = factory.CreateApiResolver();

            //MVC resolver
            DependencyResolver.SetResolver(factory.CreateMvcResolver());
        }
        public static void InitializeWith(IDependencyResolverFactory factory)
        {
            Checks.Argument.IsNotNull(factory, "factory");

            _resolver = factory.CreateInstance();
        }
示例#9
0
文件: IoC.cs 项目: ekah/Buncis
 /// <summary>
 /// Initializes the io C.
 /// </summary>
 /// <param name="factory">The factory.</param>
 public static void InitializeIoC(IDependencyResolverFactory factory)
 {
     _resolver = factory.CreateInstance();
 }
示例#10
0
 /// <summary>
 /// Initializes with the factory.
 /// </summary>
 /// <param name="factory">The factory.</param>
 public static void InitializeWith(IDependencyResolverFactory factory)
 {
     _resolver     = factory.CreateResolver();
     IsInitialized = true;
 }
 public CommandDispatcher(IDependencyResolverFactory resolverFactory)
 {
     _resolverFactory = resolverFactory;
 }
 public AllDependencyResolversTestContext(IDependencyResolverFactory factory, ITypeProvider typeProvider)
 {
     _factory = factory;
     _typeProvider = typeProvider;
 }
示例#13
0
 public static void InitializeWith(IDependencyResolverFactory factory)
 {
     Contract.Requires(Check.Argument.IsNotNull(factory));
     _resolver = factory.CreateInstance();
 }
示例#14
0
 public DiServiceBehavior(Type dependencyResolverFactoryType)
 {
     DependencyResolverFactoryType = dependencyResolverFactoryType;
     _factory = Activator.CreateInstance(DependencyResolverFactoryType) as IDependencyResolverFactory;
 }
 public WebJobBootstrapper(IDependencyResolverFactory resolverFactory)
 {
     _resolverFactory = resolverFactory;
 }
示例#16
0
 public static void InitializeWith(IDependencyResolverFactory resolverFactory)
 {
     Check.Argument.IsNotNull(resolverFactory, "resolverFactory");
     _innerResolver = resolverFactory.CreateInstance();
 }