官术网_书友最值得收藏!

Structuring the web app

A .NET Core web application is composed of the following folders:

  • Dependencies: SDK, server, and client-side dependencies
  • wwwroot: All static resources should reside here
  • Connected Services: To connect external services available in Marketplace
  • launchSettings.json: Settings required to launch a web application
  • appSettings.json: Configurations such as logging and connection strings
  • bower.json: Client-side dependencies should be configured here
  • bundleConfig.json: Bundling is moved to the JSON configuration now
  • Program.cs: Everything starts from Main() and any program can be made into a web application using the WebHostBuilder API
  • Startup.cs: For adding and configuring startup services like MVC support, logging, static files support and so on
  • ControllersViews: Part of MVC and contains actions and corresponding views

The structure we had discussed so far is illustrated in the following screenshot:

ASP.NET Core Web Application structure

The following highlighted sections in Views\Shared\_Layout.cshtml should be modified with the desired application name:

    <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1.0" />
<
title>@ViewData["Title"] - MasteringEFCore.Web</title>
...
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<p class="container">
<p class="navbar-header">
...
<a asp-area="" asp-controller="Home" asp-action="Index"
class="navbar-brand">MasteringEFCore.Web</a>
...
<p class="container body-content">
...
<footer>
<p>&copy; 2017 - MasteringEFCore.Web</p>
</footer>
...
</body>

We have created a .NET Core web application with no authentication and explored the structure of the project, which might help us understand MVC in .NET Core. If we expand the dependencies, it is evident that we don't have built-in support for Entity Framework (EF) Core. We will look at the different ways of identifying and installing the packages.

主站蜘蛛池模板: 万全县| 武冈市| 莫力| 德保县| 尼木县| 张家川| 疏附县| 防城港市| 陕西省| 苍梧县| 连江县| 秭归县| 泗洪县| 建水县| 嘉峪关市| 平顶山市| 西峡县| 大厂| 玉山县| 平遥县| 成都市| 沙河市| 洞口县| 柳林县| 阳谷县| 清水河县| 柘荣县| 嘉黎县| 措美县| 通山县| 尖扎县| 阿巴嘎旗| 洪泽县| 濮阳市| 古蔺县| 团风县| 宁远县| 上栗县| 扎兰屯市| 沙田区| 威远县|