Example #1
0
        private ShellModuleOptions GetOptions()
        {
            var result = new ShellModuleOptions();

            if (_options != null)
            {
                string clientId;
                string clientSecret;
                if (_options.TryGetValue("ClientId", out clientId))
                {
                    result.ClientId = clientId;
                }

                if (_options.TryGetValue("ClientSecret", out clientSecret))
                {
                    result.ClientSecret = clientSecret;
                }
            }

            return(result);
        }
Example #2
0
        public static IServiceCollection AddBasicShell(this IServiceCollection services, IMvcBuilder mvcBuilder, ShellModuleOptions shellModuleOptions)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

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

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

            var assembly             = typeof(HomeController).Assembly;
            var embeddedFileProvider = new EmbeddedFileProvider(assembly);

            services.Configure <RazorViewEngineOptions>(options =>
            {
                options.FileProviders.Add(embeddedFileProvider);
            });

            services.AddSingleton(shellModuleOptions);
            mvcBuilder.AddApplicationPart(assembly);
            return(services);
        }