Dotnet Core 简明教程

.NET Core - Modularity

这是 .NET Core 构建和实现模块化应用程序的另一个考虑因素。你的应用程序现在可以仅安装必需的内容,而不是安装整个 .NET Framework。我们转到 Visual Studio 并查看模块化性。

It is another consideration of .NET Core to build and implement application that is modular. Instead of installing the entire .NET Framework, your application can now just install what is required. Let us go to the visual studio and see the modularity.

这是我们在解决方案资源管理器中的简单 .NET Core 应用程序。让我们展开“引用”,你将看到对 .NETCoreApp 的引用。

Here is our simple .NET Core application, in Solution Explorer. Let us expand References and you will see reference to .NETCoreApp

dotnet core app

在 .NETCoreApp 中,你将看到对 NuGet 的程序包引用;我们展开它。

Inside .NETCoreApp, you will see package reference to NuGet; let us expand it.

nuget

你将看到一整套 NuGet 程序包引用。如果你使用过 .NET Framework,那么这些命名空间中的许多将会看起来很熟悉,因为你习惯于在 .NET Framework 中使用它。

You will see the whole series of NuGet Package references. If you have worked in .NET Framework, then many of these namespaces will look familiar, because you are used to it by using in .NET Framework.

framework
Figure 1. NET Framework is split into many different pieces and re-implemented with CoreFx; these pieces are further distributed as individual packages.
  1. Now if you expand the NETStandard.Library, you will see addition references. You will even notice System.Console which we are using in this application.

  2. Now you don’t have to bring in everything inside the .NET Framework, but just bring in what you need for your application.

  3. There are some other benefits as well; for example, these modules can be updated individually if desired.

模块化具有性能优势,并且你的应用程序可以更快地运行,尤其是 ASP.NET Core 应用程序。

Modularity leads to performance benefits and your application can run faster, especially ASP.NET Core application.