• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IOptions的典型用法代码示例。如果您正苦于以下问题:C# IOptions类的具体用法?C# IOptions怎么用?C# IOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IOptions类属于命名空间,在下文中一共展示了IOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RequestCultureMiddleware

 public RequestCultureMiddleware(RequestDelegate next, IOptions<RequestCultureOptions> options)
 {
     if (next == null) throw new ArgumentNullException(nameof(next));
     if (options == null) throw new ArgumentNullException(nameof(options));
     _next = next;
     _options = options.Value;
 }
开发者ID:eaardal,项目名称:aspnet5-workshop,代码行数:7,代码来源:RequestCultureMiddleware.cs


示例2: CommonExceptionHandlerMiddleware

 public CommonExceptionHandlerMiddleware(
     RequestDelegate next,
     ILoggerFactory loggerFactory,
     DiagnosticSource diagnosticSource,
     IOptions<ExceptionHandlerOptions> options = null
     )
 {
     _next = next;
     if(options == null)
     {
         _options = new ExceptionHandlerOptions();
     }
     else
     {
         _options = options.Value;
     }
     
     _logger = loggerFactory.CreateLogger<CommonExceptionHandlerMiddleware>();
     if (_options.ExceptionHandler == null)
     {
         _options.ExceptionHandler = _next;
     }
     _clearCacheHeadersDelegate = ClearCacheHeaders;
     _diagnosticSource = diagnosticSource;
 }
开发者ID:ReinhardHsu,项目名称:cloudscribe,代码行数:25,代码来源:CommonExceptionHandlerMiddleware.cs


示例3: DevelopmentDefaultData

 public DevelopmentDefaultData(IOptions<DevelopmentSettings> options, IDataContext dataContext, UserManager<User> userManager, RoleManager<Role> roleManager)
 {
     this.settings = options.Value;
     this.dataContext = dataContext;
     this.userManager = userManager;
     this.roleManager = roleManager;
 }
开发者ID:Supermakaka,项目名称:mvc6,代码行数:7,代码来源:DevelopmentDefaultData.cs


示例4: TwilioSMSService

        public TwilioSMSService(IOptions<SmsSettings> smsSettings)
        {
            _smsSettings = smsSettings.Value;
            //TwilioClient.Init(_smsSettings.Sid, _smsSettings.Token);
            _restClient = new TwilioRestClient(_smsSettings.Sid, _smsSettings.Token);

        }
开发者ID:codefordenver,项目名称:shelter-availability,代码行数:7,代码来源:TwilioSMSService.cs


示例5: RaygunAspNetMiddleware

    public RaygunAspNetMiddleware(RequestDelegate next, IOptions<RaygunSettings> settings, RaygunMiddlewareSettings middlewareSettings)
    {
      _next = next;
      _middlewareSettings = middlewareSettings;

      _settings = _middlewareSettings.ClientProvider.GetRaygunSettings(settings.Value ?? new RaygunSettings());  
    }
开发者ID:MindscapeHQ,项目名称:raygun4net,代码行数:7,代码来源:RaygunAspNetMiddleware.cs


示例6: RedisMessageBus

        internal RedisMessageBus(IStringMinifier stringMinifier,
                                     ILoggerFactory loggerFactory,
                                     IPerformanceCounterManager performanceCounterManager,
                                     IOptions<MessageBusOptions> optionsAccessor,
                                     IOptions<RedisScaleoutOptions> scaleoutConfigurationAccessor,
                                     IRedisConnection connection,
                                     bool connectAutomatically)
            : base(stringMinifier, loggerFactory, performanceCounterManager, optionsAccessor, scaleoutConfigurationAccessor)
        {
            _connectionString = scaleoutConfigurationAccessor.Options.ConnectionString;
            _db = scaleoutConfigurationAccessor.Options.Database;
            _key = scaleoutConfigurationAccessor.Options.EventKey;

            _connection = connection;

            _logger = loggerFactory.CreateLogger<RedisMessageBus>();

            ReconnectDelay = TimeSpan.FromSeconds(2);

            if (connectAutomatically)
            {
                ThreadPool.QueueUserWorkItem(_ =>
                {
                    var ignore = ConnectWithRetry();
                });
            }
        }
开发者ID:okusnadi,项目名称:SignalR-Redis,代码行数:27,代码来源:RedisMessageBus.cs


示例7: Unbind

        public override UnbindResult Unbind(HttpRequestData request, IOptions options)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var payload = Convert.FromBase64String(request.QueryString["SAMLRequest"].First());
            using (var compressed = new MemoryStream(payload))
            {
                using (var decompressedStream = new DeflateStream(compressed, CompressionMode.Decompress, true))
                {
                    using (var deCompressed = new MemoryStream())
                    {
                        decompressedStream.CopyTo(deCompressed);

                        var xml = new XmlDocument()
                        {
                            PreserveWhitespace = true
                        };

                        xml.LoadXml(Encoding.UTF8.GetString(deCompressed.GetBuffer()));

                        return new UnbindResult(
                            xml.DocumentElement,
                            request.QueryString["RelayState"].SingleOrDefault());
                    }
                }
            }
        }
开发者ID:feng-jing,项目名称:authservices,代码行数:30,代码来源:Saml2RedirectBinding.cs


示例8: SessionMiddleware

        /// <summary>
        /// Creates a new <see cref="SessionMiddleware"/>.
        /// </summary>
        /// <param name="next">The <see cref="RequestDelegate"/> representing the next middleware in the pipeline.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFactory"/> representing the factory that used to create logger instances.</param>
        /// <param name="sessionStore">The <see cref="ISessionStore"/> representing the session store.</param>
        /// <param name="options">The session configuration options.</param>
        public SessionMiddleware(
            RequestDelegate next,
            ILoggerFactory loggerFactory,
            ISessionStore sessionStore,
            IOptions<SessionOptions> options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            if (sessionStore == null)
            {
                throw new ArgumentNullException(nameof(sessionStore));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _next = next;
            _logger = loggerFactory.CreateLogger<SessionMiddleware>();
            _options = options.Value;
            _sessionStore = sessionStore;
            _sessionStore.Connect();
        }
开发者ID:yaobos,项目名称:Session,代码行数:39,代码来源:SessionMiddleware.cs


示例9: SiteAdminController

        public SiteAdminController(
            SiteManager siteManager,
            GeoDataManager geoDataManager,
            IOptions<MultiTenantOptions> multiTenantOptions,
            IOptions<UIOptions> uiOptionsAccessor,
            IOptions<LayoutSelectorOptions> layoutSeletorOptionsAccessor,
            ILayoutFileListBuilder layoutListBuilder
            //ConfigHelper configuration
            //, ITriggerStartup startupTrigger
            )
        {
            //if (siteResolver == null) { throw new ArgumentNullException(nameof(siteResolver)); }
            if (geoDataManager == null) { throw new ArgumentNullException(nameof(geoDataManager)); }
            //if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); }

            //config = configuration;
            this.multiTenantOptions = multiTenantOptions.Value;
            //Site = siteResolver.Resolve();

            this.siteManager = siteManager;
            this.geoDataManager = geoDataManager;
            uiOptions = uiOptionsAccessor.Value;
            this.layoutListBuilder = layoutListBuilder;
            layoutOptions = layoutSeletorOptionsAccessor.Value;

            //startup = startupTrigger;
        }
开发者ID:freemsly,项目名称:cloudscribe,代码行数:27,代码来源:SiteAdminController.cs


示例10: GravatarProvider

 public GravatarProvider(
     IOptions<AppSettings> appSettings
     , ApplicationUserManager userManager)
 {
     _appSettings = appSettings.Value;
     _userManager = userManager;
 }
开发者ID:CWISoftware,项目名称:accounts,代码行数:7,代码来源:GravatarProvider.cs


示例11: Run

        public static CommandResult Run(
            HttpRequestData request,
            string returnPath,
            IOptions options)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var binding = Saml2Binding.Get(request);
            if (binding != null)
            {
                var unbindResult = binding.Unbind(request, options);
                VerifyMessageIsSigned(unbindResult, options);
                switch (unbindResult.Data.LocalName)
                {
                    case "LogoutRequest":
                        return HandleRequest(unbindResult, options);
                    case "LogoutResponse":
                        return HandleResponse(unbindResult, request);
                    default:
                        throw new NotImplementedException();
                }
            }

            return InitiateLogout(request, returnPath, options);
        }
开发者ID:baguit,项目名称:authservices,代码行数:33,代码来源:LogOutCommand.cs


示例12: Configure

 public static void Configure(IHostingEnvironment env, IOptions<AppConfig> config)
 {
     ActionsFile = env.WebRootPath + config.Value.ActionsFile;
     ConfigsFile= env.WebRootPath + config.Value.ConfigsFile;
     LoadActions();
     LoadConfigs();
 }
开发者ID:marcodiniz,项目名称:TinBot,代码行数:7,代码来源:SuperDataBase.cs


示例13: FolderTenantNodeUrlPrefixProvider

 public FolderTenantNodeUrlPrefixProvider(
     SiteSettings currentSite,
     IOptions<MultiTenantOptions> multiTenantOptions)
 {
     site = currentSite;
     options = multiTenantOptions.Value;
 }
开发者ID:ReinhardHsu,项目名称:cloudscribe,代码行数:7,代码来源:FolderTenantNodeUrlPrefixProvider.cs


示例14: OpenSearchService

 public OpenSearchService(
     IOptions<AppSettings> appSettings,
     IUrlHelper urlHelper)
 {
     this.appSettings = appSettings;
     this.urlHelper = urlHelper;
 }
开发者ID:netusers2014,项目名称:ASP.NET-MVC-Boilerplate,代码行数:7,代码来源:OpenSearchService.cs


示例15: ProcessResponse

        private static CommandResult ProcessResponse(IOptions options, Saml2Response samlResponse)
        {
            var principal = new ClaimsPrincipal(samlResponse.GetClaims(options));

            principal = options.SPOptions.SystemIdentityModelIdentityConfiguration
                .ClaimsAuthenticationManager.Authenticate(null, principal);

            var requestState = samlResponse.GetRequestState(options);

            if(requestState == null && options.SPOptions.ReturnUrl == null)
            {
                throw new ConfigurationErrorsException(MissingReturnUrlMessage);
            }

            return new CommandResult()
            {
                HttpStatusCode = HttpStatusCode.SeeOther,
                Location = requestState?.ReturnUrl ?? options.SPOptions.ReturnUrl,
                Principal = principal,
                RelayData =
                    requestState == null
                    ? null
                    : requestState.RelayData
            };
        }
开发者ID:FutuRETI,项目名称:WebApplicationSP,代码行数:25,代码来源:AcsCommand.cs


示例16: HttpServiceGatewayMiddleware

        public HttpServiceGatewayMiddleware(
            RequestDelegate next,
            ILoggerFactory loggerFactory,
            IHttpCommunicationClientFactory httpCommunicationClientFactory,
            IOptions<HttpServiceGatewayOptions> gatewayOptions)
        {
            if (next == null)
                throw new ArgumentNullException(nameof(next));

            if (loggerFactory == null)
                throw new ArgumentNullException(nameof(loggerFactory));

            if (httpCommunicationClientFactory == null)
                throw new ArgumentNullException(nameof(httpCommunicationClientFactory));

            if (gatewayOptions?.Value == null)
                throw new ArgumentNullException(nameof(gatewayOptions));

            if (gatewayOptions.Value.ServiceName == null)
                throw new ArgumentNullException($"{nameof(gatewayOptions)}.{nameof(gatewayOptions.Value.ServiceName)}");

            // "next" is not stored because this is a terminal middleware
            _logger = loggerFactory.CreateLogger(HttpServiceGatewayDefaults.LoggerName);
            _httpCommunicationClientFactory = httpCommunicationClientFactory;
            _gatewayOptions = gatewayOptions.Value;
        }
开发者ID:CESARDELATORRE,项目名称:ServiceFabric-Http,代码行数:26,代码来源:HttpServiceGatewayMiddleware.cs


示例17: HomeController

        public HomeController(
            IBrowserConfigService browserConfigService,
#if DNX451
            // The FeedService is not available for .NET Core because the System.ServiceModel.Syndication.SyndicationFeed 
            // type does not yet exist. See https://github.com/dotnet/wcf/issues/76.
            IFeedService feedService,
#endif
            IManifestService manifestService,
            IOpenSearchService openSearchService,
            IRobotsService robotsService,
            ISitemapService sitemapService,
            IOptions<AppSettings> appSettings)
        {
            this.appSettings = appSettings;
            this.browserConfigService = browserConfigService;
#if DNX451
            // The FeedService is not available for .NET Core because the System.ServiceModel.Syndication.SyndicationFeed 
            // type does not yet exist. See https://github.com/dotnet/wcf/issues/76.
            this.feedService = feedService;
#endif
            this.manifestService = manifestService;
            this.openSearchService = openSearchService;
            this.robotsService = robotsService;
            this.sitemapService = sitemapService;
        }
开发者ID:Pro-Coded,项目名称:Pro.MVCMagic,代码行数:25,代码来源:HomeController.cs


示例18: DnxProjectSystem

        public DnxProjectSystem(OmnisharpWorkspace workspace,
                                    IOmnisharpEnvironment env,
                                    IOptions<OmniSharpOptions> optionsAccessor,
                                    ILoggerFactory loggerFactory,
                                    IMetadataFileReferenceCache metadataFileReferenceCache,
                                    IApplicationLifetime lifetime,
                                    IFileSystemWatcher watcher,
                                    IEventEmitter emitter,
                                    DnxContext context)
        {
            _workspace = workspace;
            _env = env;
            _logger = loggerFactory.CreateLogger<DnxProjectSystem>();
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _options = optionsAccessor.Options;
            _dnxPaths = new DnxPaths(env, _options, loggerFactory);
            _designTimeHostManager = new DesignTimeHostManager(loggerFactory, _dnxPaths);
            _packagesRestoreTool = new PackagesRestoreTool(_options, loggerFactory, emitter, context, _dnxPaths);
            _context = context;
            _watcher = watcher;
            _emitter = emitter;
            _directoryEnumerator = new DirectoryEnumerator(loggerFactory);

            lifetime.ApplicationStopping.Register(OnShutdown);
        }
开发者ID:fogzot,项目名称:monodevelop-dnx-addin,代码行数:25,代码来源:DnxProjectSystem.cs


示例19: CustomUrlHelper

 public CustomUrlHelper(IScopedInstance<ActionContext> contextAccessor, IActionSelector actionSelector,
                        IOptions<AppOptions> appOptions)
     : base(contextAccessor, actionSelector)
 {
     _appOptions = appOptions;
     _httpContext = contextAccessor.Value.HttpContext;
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:CustomUrlHelper.cs


示例20: SingleActionApplicationModelConvention

 public SingleActionApplicationModelConvention(IOptions<SingleActionControllerOptions> optionsAccessor)
 {
     options = optionsAccessor.Value;
     if(!options.IsOptionsConfigured) {
         throw new Exception("SingleActionControllerOptions class not configured in Startup.");
     }
 }
开发者ID:CodeMachina,项目名称:Sandbox2015,代码行数:7,代码来源:SingleActionApplicationModelConvention.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IOrchardServices类代码示例发布时间:2022-05-24
下一篇:
C# IOptionService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap