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


C# IOptions类代码示例

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


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


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