本文整理汇总了C#中Container.Log方法的典型用法代码示例。如果您正苦于以下问题:C# Container.Log方法的具体用法?C# Container.Log怎么用?C# Container.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container.Log方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: T02
public void T02()
{
var container = new Container(defaultLifestyle: DefaultLifestyle.Singleton, log: Write, assemblies: typeof(string).Assembly);
container.RegisterSingleton<IClassA, ClassA>();
Write("");
container.Log();
}
示例2: T06_auto_singleton
public void T06_auto_singleton()
{
var container = new Container(DefaultLifestyle.Singleton, log:Write);
// SomeClass is registered as transient
container.Resolve<Func<SomeClass>>();
Write("");
container.Log();
}
示例3: T07_auto_singleton
public void T07_auto_singleton()
{
var container = new Container(DefaultLifestyle.Singleton, log: Write);
// SomeClass registered as singleton
container.Resolve<SomeClass>();
// cannot resolve Func of singleton
Assert.Throws<TypeAccessException>(() => container.Resolve<Func<SomeClass>>()).WriteMessageTo(Write);
Write("");
container.Log();
}
示例4: T08_instance_of_factory
public void T08_instance_of_factory()
{
var container = new Container(log: Write);
Func<SomeClass> factory = () => new SomeClass();
container.RegisterInstance(factory);
var f = container.Resolve<Func<SomeClass>>();
Assert.Equal(f, factory);
Assert.NotEqual(f(), factory());
Write("");
container.Log();
}