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


C# IContainer.AssertConfigurationIsValid方法代码示例

本文整理汇总了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");
        }
开发者ID:brandonmartinez,项目名称:Manufacturing.Api,代码行数:33,代码来源:Global.asax.cs

示例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);
            }
        }
开发者ID:dstarosta,项目名称:GitProjects,代码行数:18,代码来源:RestConfigurator.cs

示例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();
        }
开发者ID:edraheim,项目名称:Manufacturing.DevRunner,代码行数:26,代码来源:Program.cs


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