本文整理汇总了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;
}
示例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);
}
示例3: SetUp
public void SetUp()
{
container = new UnityContainer();
settings = new ExceptionHandlingSettings();
configurationSource = new DictionaryConfigurationSource();
configurationSource.Add(ExceptionHandlingSettings.SectionName, settings);
container.AddExtension(new EnterpriseLibraryCoreExtension(configurationSource));
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}