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


C# Funq.TryResolve方法代码示例

本文整理汇总了C#中Funq.TryResolve方法的典型用法代码示例。如果您正苦于以下问题:C# Funq.TryResolve方法的具体用法?C# Funq.TryResolve怎么用?C# Funq.TryResolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Funq的用法示例。


在下文中一共展示了Funq.TryResolve方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configure

        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            Plugins.Add(new SwaggerFeature());

            //Register all your dependencies:
            DependencyConfig.ResolveDependencies(container);

            //Enable Authentication an Registration
            AuthConfig.ConfigureAuth(Plugins,container);

            //Configure Custom User Defined REST Paths for your services
            RouteConfig.ConfigureServiceRoutes(Routes);

            //Change the default ServiceStack configuration
            //const Feature disableFeatures = Feature.Jsv | Feature.Soap;
            SetConfig(new EndpointHostConfig
            {
                //EnableFeatures = Feature.All.Remove(disableFeatures),
                AppendUtf8CharsetOnContentTypes = new HashSet<string> { ContentType.Html },
                DebugMode = true, //Show StackTraces in service responses during development
            });

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            ServiceStackController.CatchAllController = reqCtx => container.TryResolve<HomeController>();
        }
开发者ID:xmkevin,项目名称:ym,代码行数:29,代码来源:AppHost.cs

示例2: Configure

        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            //Load environment config from text file if exists
            var liveSettings = "~/appsettings.txt".MapHostAbsolutePath();
            var appSettings = File.Exists(liveSettings)
                ? (IAppSettings)new TextFileSettings(liveSettings)
                : new AppSettings();
            AppConfig = new AppConfig(appSettings);
            container.Register(AppConfig);

            //Change the default ServiceStack configuration
            //const Feature disableFeatures = Feature.Jsv | Feature.Soap;
            SetConfig(new HostConfig
            {
                AppendUtf8CharsetOnContentTypes = new HashSet<string> { MimeTypes.Html },
                HandlerFactoryPath = "api",
                DebugMode = true,
            });

            //Register a external dependency-free
            container.Register<ICacheClient>(new MemoryCacheClient());
            //Configure an alt. distributed persistent cache that survives AppDomain restarts. e.g Redis
            //container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379"));

            //Enable Authentication an Registration
            ConfigureAuth(container, appSettings);

            //Create your own custom User table
            using (var db = container.Resolve<IDbConnectionFactory>().Open())
                db.DropAndCreateTable<User>();

            //Register application services
            container.Register(new TodoRepository());
            container.Register<ITwitterGateway>(new TwitterGateway());

            //Configure Custom User Defined REST Paths for your services
            ConfigureServiceRoutes();

            Plugins.Add(new SwaggerFeature { UseBootstrapTheme = true });
            Plugins.Add(new PostmanFeature());
            Plugins.Add(new CorsFeature());

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            ServiceStackController.CatchAllController = reqCtx => container.TryResolve<HomeController>();
        }
开发者ID:ServiceStackApps,项目名称:SocialBootstrapApi,代码行数:49,代码来源:AppHost.cs

示例3: Configure

        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            //Configure User Defined REST Paths
            //Routes
            //  .Add<Hello>("/hello")
            //  .Add<Hello>("/hello/{Name*}");

            //Uncomment to change the default ServiceStack configuration
            //SetConfig(new EndpointHostConfig {
            //});

            //Register Typed Config some services might need to access
            var appSettings = new AppSettings();
            AppConfig = new AppConfig(appSettings);
            container.Register(AppConfig);

            //Register all your dependencies
            //container.Register(new TodoRepository());
            container.Register<ICacheClient>(new MemoryCacheClient());

            // Register DB
            container.Register<IDbConnectionFactory>(c =>
                                                     new OrmLiteConnectionFactory(
                                                         "~/App_Data/db.sqlite".MapHostAbsolutePath(),
                                                         SqliteOrmLiteDialectProvider.Instance));

            // Reset DB
            using (var resetDb = container.Resolve<ResetDbService>())
            {
                resetDb.Any(null);
            }

            //Enable Authentication
            ConfigureAuth(container);

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            ServiceStackController.CatchAllController = reqCtx => container.TryResolve<HomeController>();
        }
开发者ID:peter-dangelo,项目名称:ServiceStackMVC,代码行数:42,代码来源:AppHost.cs

示例4: Configure

        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            //Register Typed Config some services might need to access
            var appSettings = new AppSettings();
            Config = new AppConfig(appSettings);
            container.Register(Config);

            //Register all your dependencies:

            //Register a external dependency-free
            container.Register<ICacheClient>(new MemoryCacheClient());
            //Configure an alt. distributed peristed cache that survives AppDomain restarts. e.g Redis
            //container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379"));

            //Enable Authentication an Registration
            ConfigureAuth(container);

            //Create you're own custom User table
            var dbFactory = container.Resolve<IDbConnectionFactory>();
            dbFactory.Exec(dbCmd => dbCmd.CreateTable<User>(overwrite: true));

            //Register application services
            container.Register(new TodoRepository());
            container.Register<ITwitterGateway>(new TwitterGateway());

            //Configure Custom User Defined REST Paths for your services
            ConfigureServiceRoutes();

            //Change the default ServiceStack configuration
            //const Feature disableFeatures = Feature.Jsv | Feature.Soap;
            SetConfig(new EndpointHostConfig {
                //EnableFeatures = Feature.All.Remove(disableFeatures),
                AppendUtf8CharsetOnContentTypes = new HashSet<string> { ContentType.Html },
                DebugMode = true, //Show StackTraces in service responses during development
            });

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            ServiceStackController.CatchAllController = reqCtx => container.TryResolve<HomeController>();
        }
开发者ID:bonder,项目名称:SocialBootstrapApi,代码行数:43,代码来源:AppHost.cs

示例5: Configure

        public override void Configure(Funq.Container container)
        {
            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            //Register Typed Config some services might need to access
            var appSettings = new AppSettings();
            AppConfig = new AppConfig(appSettings);
            container.Register(AppConfig);

            //Register all your dependencies:

            //Register a external dependency-free
            container.Register<ICacheClient>(new MemoryCacheClient());
            //Configure an alt. distributed persistent cache that survives AppDomain restarts. e.g Redis
            //container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379"));

            //Enable Authentication an Registration
            ConfigureAuth(container);

            //Create your own custom User table
            using (var db = container.Resolve<IDbConnectionFactory>().Open())
                db.DropAndCreateTable<User>();

            //Register application services
            container.Register(new TodoRepository());
            container.Register<ITwitterGateway>(new TwitterGateway());

            //Configure Custom User Defined REST Paths for your services
            ConfigureServiceRoutes();

            //Change the default ServiceStack configuration
            //const Feature disableFeatures = Feature.Jsv | Feature.Soap;
            SetConfig(new HostConfig {
                //EnableFeatures = Feature.All.Remove(disableFeatures),
                AppendUtf8CharsetOnContentTypes = new HashSet<string> { MimeTypes.Html },
            });

            Plugins.Add(new SwaggerFeature());
            Plugins.Add(new CorsFeature());

            //Set MVC to use the same Funq IOC as ServiceStack
            ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));
            ServiceStackController.CatchAllController = reqCtx => container.TryResolve<HomeController>();
        }
开发者ID:hkleist,项目名称:SocialBootstrapApi,代码行数:45,代码来源:AppHost.cs


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