本文整理汇总了C#中ILifetimeScope.Update方法的典型用法代码示例。如果您正苦于以下问题:C# ILifetimeScope.Update方法的具体用法?C# ILifetimeScope.Update怎么用?C# ILifetimeScope.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILifetimeScope
的用法示例。
在下文中一共展示了ILifetimeScope.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationStartup
protected override void ApplicationStartup(ILifetimeScope container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
// register interfaces/implementations
container.Update(builder => builder
//.RegisterType<CouchDbTShirtRepository>()
.RegisterType<MockedTShirtRepository>()
.As<ITShirtRepository>());
// register MyCouchStore parameter for couchdb repo classes
container.Update(builder => builder
.RegisterType<MyCouchStore>()
.As<IMyCouchStore>()
.UsingConstructor(typeof (string), typeof (string))
.WithParameters(new [] {
new NamedParameter("dbUri","http://seraya_dba:[email protected]:5984/"),
new NamedParameter("dbName","cshirts")
})
);
// TODO: remove after implementing REST-Api & replacing razor with angular
// display razor error messages
StaticConfiguration.DisableErrorTraces = false;
}
示例2: ConfigureApplicationContainer
protected override void ConfigureApplicationContainer(ILifetimeScope container)
{
Container = container;
var jsonSettings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
container.Update(builder =>
{
builder.Register(c => JsonSerializer.Create(jsonSettings))
.SingleInstance();
builder.RegisterAssemblyTypes(typeof(AlephRepository).Assembly)
.AsImplementedInterfaces();
builder.RegisterType<EnvironmentPathProvider>()
.As<IEnvironmentPathProvider>()
.SingleInstance();
builder.RegisterType<FavoritesRepository>().As<IFavoritesRepository>().SingleInstance(); // todo: singleton while its impl only keeps favorite state in-memory.
builder.RegisterType<AlephAuthenticationProvider>().As<IAuthenticationProvider>();
builder.RegisterType<NancyContextAuthenticator>().AsSelf().SingleInstance();
builder.RegisterType<LibraryListDynamicRepository>().AsSelf();
builder.RegisterType<LibraryListXmlRepository>().AsSelf();
});
}
示例3: ConfigureApplicationContainer
protected override void ConfigureApplicationContainer(ILifetimeScope container)
{
//Pull in module built in Data project
container.Update(builder=> builder.RegisterModule(new DataIocModule()));
base.ConfigureApplicationContainer(container);
}