コード例 #1
0
ファイル: HomeController.cs プロジェクト: salixzs/Dapper.Cqrs
        public ContentResult Index()
        {
            Dictionary <string, string> configurationItems =
                _configLoader.GetConfigurationValues(new HashSet <string>
            {
                "Logging", "Database"
            });

            var       apiAssembly = Assembly.GetAssembly(typeof(Startup));
            IndexPage indexPage   = new IndexPage("Sample API")
                                    .SetDescription("Database access through Dapper with CQRS.")
                                    .SetHostingEnvironment(_hostingEnvironment.EnvironmentName)
                                    .SetVersionFromAssembly(apiAssembly, 2)
                                    .SetBuildTimeFromAssembly(apiAssembly)
                                    .SetHealthPageUrl(HealthTestEndpoint)
                                    .SetSwaggerUrl("/swagger/index.html")
                                    .SetConfigurationValues(configurationItems);

#if DEBUG
            indexPage.SetBuildMode("#DEBUG (Should not be in production!)");
#else
            indexPage.SetBuildMode("Release");
#endif

            return(new ContentResult
            {
                ContentType = "text/html",
                StatusCode = (int)HttpStatusCode.OK,
                Content = indexPage.GetContents(),
            });
        }