当前位置: 首页>>代码示例>>C#>>正文


C# IUnityContainer.AddExtension方法代码示例

本文整理汇总了C#中IUnityContainer.AddExtension方法的典型用法代码示例。如果您正苦于以下问题:C# IUnityContainer.AddExtension方法的具体用法?C# IUnityContainer.AddExtension怎么用?C# IUnityContainer.AddExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUnityContainer的用法示例。


在下文中一共展示了IUnityContainer.AddExtension方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Boot

        public static ITypeFactory Boot(string loggerName,Assembly asm)
        {
            XmlConfigurator.Configure();
            container = new UnityContainer();

            RegisterKnownTypes(asm);
            RegisterKnownTypes(typeof(ITypeFactory).Assembly);

            container.RegisterInstance<ITypeFactory>(new TypeFactory(container));
            container.RegisterInstance<ILog>(LogManager.GetLogger(loggerName));

            container.RegisterInstance<ICommandRouter>(new CommandRouterImpl());
            factory = container.Resolve<ITypeFactory>();

            factory.Get<ILog>().Info(".=.=.=. " + Assembly.GetExecutingAssembly().GetName().Name + " =.=.=.=");
            factory.Get<ILog>().Info("Version:" + Assembly.GetExecutingAssembly().GetName().Version.ToString());

            string dataPath = ApplicationEnvironment.Instance.DataPath;
            if (!Directory.Exists(dataPath))
            {
                factory.Get<ILog>().Error("L'applicazione non riesce a creare il percorso dati:" + dataPath);
            }
            factory.Get<ILog>().Debug("Data path applicazione:"+dataPath);

            container.AddExtension(new WireImportExports());
            return factory;
        }
开发者ID:mausch,项目名称:NHWorkbench,代码行数:27,代码来源:BootStrap.cs

示例2: ConfigureContainer

        protected override void ConfigureContainer(IUnityContainer container)
        {
            Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(container, "container");

            var extensionType = this.GetExtensionType();
            var extension = (UnityContainerExtension)container.Resolve(extensionType);
            container.AddExtension(extension);
        }
开发者ID:kangkot,项目名称:unity,代码行数:8,代码来源:ContainerExtensionElement.cs

示例3: SetUp

        public void SetUp()
        {
            container = new UnityContainer();

            settings = new ExceptionHandlingSettings();
            configurationSource = new DictionaryConfigurationSource();
            configurationSource.Add(ExceptionHandlingSettings.SectionName, settings);

            container.AddExtension(new EnterpriseLibraryCoreExtension(configurationSource));
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:10,代码来源:WrapHandlerPolicyCreatorFixture.cs

示例4: PreCompose

        /// <summary>
        /// Creates the instance of the Unity container.
        /// </summary>
        protected override void PreCompose()
        {
            unityContainer = new UnityContainer();

            var locator = new UnityServiceLocator(unityContainer);
            exportProvider = new CSLExportProvider(locator);

            unityContainer.AddExtension(new CSLExportProviderExtension(exportProvider));

            RegisterTypes();
        }
开发者ID:blagojcej,项目名称:JBSolutions,代码行数:14,代码来源:Global.asax.cs

示例5: Init

        public void Init(HttpApplication context)
        {
            if (_container == null)
            {
                var appAsUnityAccessor = (context as IUnityContainerAccessor);
                if (appAsUnityAccessor == null)
                    throw new Exception("The http application must implement \"Thingie.Tracking.Unity.ASPNET.IUnityContainerAccessor\" for the TrackingModule to work! Please implement the interface in global.asax.");

                _container = appAsUnityAccessor.Container;
                RegisterTrackers(_container);
                _container.AddExtension(new TrackingExtension());
            }

            context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
            context.PostRequestHandlerExecute += new EventHandler(context_PostRequestHandlerExecute);
        }
开发者ID:arumata,项目名称:Thingie.Tracking,代码行数:16,代码来源:TrackingModule.cs

示例6: ConfigureContainer

        protected override void ConfigureContainer(IUnityContainer container)
        {
            var interception = new ExtendedInterception();
            if (!string.IsNullOrEmpty(Interceptor))
            {
                var type = Type.GetType(Interceptor);
                if (null == type)
                {
                    throw new ConfigurationErrorsException(string.Format("The {0} is not a valid Interceptor.",
                        Interceptor));
                }

                if (!typeof (IInterceptor).IsAssignableFrom(type))
                {
                    throw new ConfigurationErrorsException(string.Format("The {0} is not a valid Interceptor.",
                        Interceptor));
                }
                interception.Interceptor = (IInterceptor) Activator.CreateInstance(type);
            }

            container.AddExtension(interception);
        }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:22,代码来源:ExtendedInterceptionElement.cs

示例7: SetUp

		public void SetUp()
		{
			container = new UnityContainer();
			container.AddExtension(new EnterpriseLibraryCoreExtension());
			CryptographerFixture.CreateKeyFile(keyedHashKeyFile);
		}
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:6,代码来源:KeyedHashAlgorithmProviderPolicyCreationFixture.cs

示例8: Setup

 public virtual void Setup()
 {
     Container = new UnityContainer();
     MockUnit.Setup();
     Container.AddExtension(MockUnit.Extension);
 }
开发者ID:stormleoxia,项目名称:lx,代码行数:6,代码来源:MockUnitTestFixture.cs

示例9: SetUp

 public void SetUp()
 {
     container = new UnityContainer();
     container.AddExtension(new EnterpriseLibraryCoreExtension());
 }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:5,代码来源:LoggingExceptionHandlerPolicyCreatorFixture.cs

示例10: RegisterTypes

 private void RegisterTypes(IUnityContainer container)
 {
     //Register Common unity container
     var commonContainer = new CommonUnityExtension();
     container.AddExtension(commonContainer);
 }
开发者ID:singhprakash,项目名称:sl-wpf-layouteditor-master,代码行数:6,代码来源:Bootstrapper.cs

示例11: ConfigureContainer

 /// <summary>
 /// Add the extension specified in this element to the container.
 /// </summary>
 /// <param name="container">Container to configure.</param>
 protected override void ConfigureContainer(IUnityContainer container)
 {
     var extensionType = GetExtensionType();
     var extension = (UnityContainerExtension)container.Resolve(extensionType);
     container.AddExtension(extension);
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:10,代码来源:ContainerExtensionElement.cs


注:本文中的IUnityContainer.AddExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。