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


C# ILifetimeScope.Update方法代码示例

本文整理汇总了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;
        }
开发者ID:takahser,项目名称:C-Shirts,代码行数:25,代码来源:Bootstrapper.cs

示例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();
            });
        }
开发者ID:khellang,项目名称:Solvberget,代码行数:33,代码来源:Bootstrapper.cs

示例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);
 }
开发者ID:nathandl86,项目名称:SqlServerDocumenterUtility,代码行数:6,代码来源:Bootstrapper.cs


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