本文整理汇总了C#中Microsoft.Practices.Unity.UnityContainer.RemoveAllExtensions方法的典型用法代码示例。如果您正苦于以下问题:C# UnityContainer.RemoveAllExtensions方法的具体用法?C# UnityContainer.RemoveAllExtensions怎么用?C# UnityContainer.RemoveAllExtensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Practices.Unity.UnityContainer
的用法示例。
在下文中一共展示了UnityContainer.RemoveAllExtensions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNewExtensionToUnityContainer
public void AddNewExtensionToUnityContainer()
{
//unitycontainer :Creates a default UnityContainer. Returns a reference to the new container
//as an instance of the IUnityContainer interface.
//AddNewExtension : Creates a new extension object of type TExtension and adds it to the container. The
//extension type must have a zero-argument public constructor. Returns a reference to the container
IUnityContainer container = new UnityContainer().AddNewExtension<StaticFactoryExtension>();
// container.Register<Container, UnityContainer>;
Assert.IsNotNull(container);
container = container.RemoveAllExtensions();
Assert.IsNotNull(container);
}
示例2: Test_TaskID_16777
public void Test_TaskID_16777()
{
UnityContainer uc = new UnityContainer();
uc.RemoveAllExtensions();
uc.AddExtension(new MyExtension());
uc.RegisterType<UnityTestClass>(new ContainerControlledLifetimeManager());
UnityTestClass mytestparent = uc.Resolve<UnityTestClass>();
}
示例3: Ext_RemovingAllExtensionsDisablesDefaultBehavior
public void Ext_RemovingAllExtensionsDisablesDefaultBehavior()
{
IUnityContainer container = new UnityContainer();
container.RemoveAllExtensions();
object result = container.Resolve<object>();
Assert.IsNull(result);
}