本文整理汇总了C#中IContainer.AssertConfigurationIsValid方法的典型用法代码示例。如果您正苦于以下问题:C# IContainer.AssertConfigurationIsValid方法的具体用法?C# IContainer.AssertConfigurationIsValid怎么用?C# IContainer.AssertConfigurationIsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContainer
的用法示例。
在下文中一共展示了IContainer.AssertConfigurationIsValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application_Start
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
LoggingUtils.InitializeLogging(true);
Log.Info("Manufacturing API Starting");
Log.Debug("Loading Configuration...");
Bootstrapper
.With.StructureMap()
.And.ServiceLocator()
.LookForTypesIn.ReferencedAssemblies().Including
.Assembly(Assembly.GetAssembly(typeof(ApiContainer)))
.Start();
_container = (IContainer)Bootstrapper.Container;
GlobalConfiguration.Configuration.DependencyResolver = new StructureMapDependencyResolver(_container);
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat;
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;
//This is just for intellisense when stepping through...
var what = _container.WhatDoIHave();
//Ensure our IoC is happy
_container.AssertConfigurationIsValid();
Log.Debug("IoC configuration is valid");
Log.Info("API Started");
}
示例2: CreateServiceLocator
public static IServiceLocator CreateServiceLocator(IContainer container, bool mockContext)
{
try
{
var serviceBuilder = new ServiceBuilder(container);
serviceBuilder.Build(mockContext);
#if DEBUG
container.AssertConfigurationIsValid();
#endif
return new ServiceLocator(container);
}
catch (Exception ex)
{
throw new ServiceActivationException(String.Format(CultureInfo.InvariantCulture, Properties.Resources.DependencyRegistrationError, ex.Message), ex);
}
}
示例3: Main
private static void Main(string[] args)
{
LoggingUtils.InitializeLogging(true);
Console.WriteLine("Loading Configuration...");
Bootstrapper.With.StructureMap()
.And.ServiceLocator()
.LookForTypesIn.ReferencedAssemblies()
.Including.Assembly(Assembly.GetAssembly(typeof(FrameworkContainer)))
.AndAssembly(Assembly.GetAssembly(typeof(DataCollectorContainer)))
.AndAssembly(Assembly.GetAssembly(typeof(DataPusherContainer)))
.AndAssembly(Assembly.GetAssembly(typeof(WorkerRole)))
//.With.StartupTasks()
.Start();
_container = (IContainer)Bootstrapper.Container;
//This is just for intellisense when stepping through...
var what = _container.WhatDoIHave();
//Ensure our IoC is happy
_container.AssertConfigurationIsValid();
Log.Debug("IoC configuration is valid");
DisplayMenu();
}