本文整理汇总了C#中Autofac.ContainerBuilder.RegisterViewModels方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerBuilder.RegisterViewModels方法的具体用法?C# ContainerBuilder.RegisterViewModels怎么用?C# ContainerBuilder.RegisterViewModels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autofac.ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder.RegisterViewModels方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
protected override void Load(ContainerBuilder moduleBuilder)
{
base.Load(moduleBuilder);
moduleBuilder.RegisterModule<Zetbox.App.Projekte.Common.CustomCommonActionsModule>();
moduleBuilder.RegisterZetboxImplementors(typeof(CustomClientActionsModule).Assembly);
moduleBuilder.RegisterViewModels(typeof(CustomClientActionsModule).Assembly);
}
示例2: Load
protected override void Load(ContainerBuilder moduleBuilder)
{
base.Load(moduleBuilder);
moduleBuilder.RegisterModule<Common.CommonModule>();
// Register additional module dependencies, for example workflow and parties
// moduleBuilder.RegisterModule<Zetbox.Workflow.Client.ClientModule>();
// moduleBuilder.RegisterModule<Zetbox.Parties.Client.ClientModule>();
moduleBuilder.RegisterZetboxImplementors(typeof(ClientModule).Assembly);
moduleBuilder.RegisterViewModels(typeof(ClientModule).Assembly);
// Register explicit overrides here
}
示例3: Load
protected override void Load(ContainerBuilder moduleBuilder)
{
base.Load(moduleBuilder);
moduleBuilder.RegisterModule<Zetbox.API.Common.ApiCommonModule>();
moduleBuilder.RegisterModule<Zetbox.API.Client.ClientApiModule>();
moduleBuilder
.Register<ViewModelDependencies>(c => new ViewModelDependencies(
c.Resolve<IViewModelFactory>(),
c.Resolve<IFrozenContext>(),
c.Resolve<IPrincipalResolver>(),
c.Resolve<IIconConverter>(),
c.Resolve<IAssetsManager>(),
c.Resolve<IValidationManager>(),
c.Resolve<IPerfCounter>()))
.As<IViewModelDependencies>();
moduleBuilder
.Register<LoggingProblemReporter>(c => new LoggingProblemReporter())
.As<IProblemReporter>()
.SingleInstance();
moduleBuilder
.Register<ZetboxContextHttpScope>(c => new ZetboxContextHttpScope(c.Resolve<IZetboxContext>(), c.Resolve<IMVCValidationManager>()))
.InstancePerHttpRequest();
moduleBuilder
.RegisterType<AspNetViewModelFactory>()
.As<IViewModelFactory>()
.As<IToolkit>()
.InstancePerLifetimeScope(); // Not per HTTP Request, as custom actions also need a ViewModelFactory. They'll get the root scope.
moduleBuilder
.RegisterType<Zetbox.Client.GUI.DialogCreator>()
.AsSelf()
.InstancePerDependency();
moduleBuilder
.RegisterType<MVCValidationManager>()
.As<IValidationManager>()
.As<IMVCValidationManager>()
.InstancePerHttpRequest();
moduleBuilder.RegisterViewModels(typeof(ClientModule).Assembly);
moduleBuilder.RegisterModule((Module)Activator.CreateInstance(Type.GetType("Zetbox.App.Projekte.Client.CustomClientActionsModule, Zetbox.App.Projekte.Client", true)));
}
示例4: Load
protected override void Load(ContainerBuilder moduleBuilder)
{
base.Load(moduleBuilder);
moduleBuilder.RegisterZetboxImplementors(typeof(CustomClientActionsModule).Assembly);
moduleBuilder.RegisterViewModels(typeof(CustomClientActionsModule).Assembly);
// Register explicit overrides here
moduleBuilder
.Register<Zetbox.App.Projekte.Client.Projekte.Reporting.ReportingHost>(c => new Zetbox.App.Projekte.Client.Projekte.Reporting.ReportingHost(
"Zetbox.App.Projekte.Client.DerivedReportTest",
typeof(CustomClientActionsModule).Assembly,
c.Resolve<IFileOpener>(),
c.Resolve<ITempFileService>()
)
)
.InstancePerDependency();
}
示例5: Load
protected override void Load(ContainerBuilder moduleBuilder)
{
base.Load(moduleBuilder);
moduleBuilder
.Register<SynchronousThreadManager>(c => new SynchronousThreadManager())
.As<IAsyncThreadManager>()
.As<IUiThreadManager>();
moduleBuilder
.Register<ViewModelDependencies>(c => new ViewModelDependencies(
c.Resolve<IViewModelFactory>(),
c.Resolve<IUiThreadManager>(),
c.Resolve<IAsyncThreadManager>(),
c.Resolve<IFrozenContext>(),
c.Resolve<IIdentityResolver>()))
.As<IViewModelDependencies>();
moduleBuilder
.Register<ThreadPrincipalResolver>(c=> new ThreadPrincipalResolver(c.Resolve<Func<IReadOnlyZetboxContext>>()))
.As<IIdentityResolver>()
.InstancePerLifetimeScope();
moduleBuilder
.Register<LoggingProblemReporter>(c => new LoggingProblemReporter())
.As<IProblemReporter>()
.SingleInstance();
moduleBuilder
.Register<DefaultCredentialsResolver>(c => new DefaultCredentialsResolver())
.As<ICredentialsResolver>()
.SingleInstance();
moduleBuilder
.RegisterType<Zetbox.Client.GUI.DialogCreator>()
.AsSelf()
.InstancePerDependency();
moduleBuilder.RegisterViewModels(typeof(ClientModule).Assembly);
}
示例6: Load
protected override void Load(ContainerBuilder moduleBuilder)
{
base.Load(moduleBuilder);
moduleBuilder.RegisterModule<Zetbox.API.Common.ApiCommonModule>();
moduleBuilder.RegisterModule<Zetbox.API.Client.ClientApiModule>();
moduleBuilder
.Register<ViewModelDependencies>(c => new ViewModelDependencies(
c.Resolve<IViewModelFactory>(),
c.Resolve<IFrozenContext>(),
c.Resolve<IPrincipalResolver>(),
c.Resolve<IIconConverter>(),
c.Resolve<IAssetsManager>(),
c.Resolve<IValidationManager>(),
c.Resolve<IPerfCounter>()))
.As<IViewModelDependencies>();
moduleBuilder
.Register<LifetimeScopeFactory>(c => new LifetimeScopeFactory(c.Resolve<ILifetimeScope>()))
.As<ILifetimeScopeFactory>()
.SingleInstance();
moduleBuilder
.Register<ThreadPrincipalResolver>(c => new ThreadPrincipalResolver(c.Resolve<ILifetimeScope>()))
.As<IPrincipalResolver>()
.SingleInstance();
moduleBuilder
.Register<LoggingProblemReporter>(c => new LoggingProblemReporter())
.As<IProblemReporter>()
.SingleInstance();
moduleBuilder
.Register<DefaultCredentialsResolver>(c => new DefaultCredentialsResolver())
.As<ICredentialsResolver>()
.SingleInstance();
moduleBuilder
.RegisterType<Zetbox.Client.GUI.DialogCreator>()
.AsSelf()
.InstancePerDependency();
moduleBuilder
.RegisterType<ZetboxContextExceptionHandler>()
.As<IZetboxContextExceptionHandler>()
.SingleInstance();
moduleBuilder
.RegisterType<Zetbox.Client.Reporting.ReportingErrorDialog>()
.AsImplementedInterfaces()
.InstancePerDependency();
moduleBuilder
.RegisterType<ValidationManager>()
.As<IValidationManager>()
.InstancePerLifetimeScope();
moduleBuilder
.Register<Zetbox.Client.Reporting.ReportingHost>(c => new Zetbox.Client.Reporting.ReportingHost(
"Zetbox.App.Projekte.Client.DerivedReportTest",
typeof(ClientModule).Assembly,
c.Resolve<IFileOpener>(),
c.Resolve<ITempFileService>(),
c.Resolve<IReportingErrorReporter>()
)
)
.InstancePerDependency();
moduleBuilder
.RegisterType<UIExceptionReporter>()
.As<IUIExceptionReporter>()
.SingleInstance();
moduleBuilder.RegisterViewModels(typeof(ClientModule).Assembly);
moduleBuilder.RegisterModule((Module)Activator.CreateInstance(Type.GetType("Zetbox.DalProvider.Client.ClientProvider, Zetbox.DalProvider.ClientObjects", true)));
moduleBuilder.RegisterModule((Module)Activator.CreateInstance(Type.GetType("Zetbox.App.Projekte.Client.CustomClientActionsModule, Zetbox.App.Projekte.Client", true)));
}
示例7: ConfigureContainerBuilder
protected virtual void ConfigureContainerBuilder(ContainerBuilder builder)
{
builder.RegisterControllers(typeof(ZetboxMvcApplication).Assembly);
builder.RegisterModelBinders(typeof(ZetboxMvcApplication).Assembly);
builder.RegisterModelBinderProvider();
// Register our model binder manual, as they also deal with derived impelementations
builder
.RegisterType<ZetboxViewModelBinderProvider>()
.As<IZetboxViewModelBinderProvider>()
.SingleInstance();
builder
.RegisterType<ZetboxViewModelBinder>()
.As<IZetboxViewModelBinder>()
.InstancePerHttpRequest(); // ZetboxViewModelBinder has some http request dependencies
builder
.RegisterType<LookupDictionaryModelBinderProvider>()
.As<ILookupDictionaryModelBinderProvider>()
.SingleInstance();
builder
.RegisterType<LookupDictionaryModelBinder>()
.As<ILookupDictionaryModelBinder>()
.SingleInstance();
builder.RegisterModule<AspNetClientModule>();
// Register zetbox specific ViewModels
builder.RegisterViewModels(typeof(ZetboxMvcApplication).Assembly);
// Register target applications specific Controller and ViewModels
builder.RegisterControllers(this.GetType().Assembly);
builder.RegisterViewModels(this.GetType().Assembly);
}