From f62d45df45090a3ffd776f973cd694b6197999fb Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 10 Oct 2018 15:05:53 +0800 Subject: [PATCH] Translate the Getting-Started-Console-Application document. --- .../Getting-Started-Console-Application.md | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/zh-Hans/Getting-Started-Console-Application.md b/docs/zh-Hans/Getting-Started-Console-Application.md index ab7530522b..0cccb6839a 100644 --- a/docs/zh-Hans/Getting-Started-Console-Application.md +++ b/docs/zh-Hans/Getting-Started-Console-Application.md @@ -1,24 +1,24 @@ -## Getting Started ABP With Console Application +## 使用Console Application -This tutorial explains how to start ABP from scratch with minimal dependencies. You generally want to start with a **[startup template](https://abp.io/Templates)**. +本教程将介绍如何从头开始以最小的依赖关系启动ABP. 您通常希望以 **[启动模板](https://abp.io/Templates)** 开头。 -### Create A New Project +### 创建一个新项目 -Create a new Regular .Net Core Console Application from Visual Studio: +使用Visual Studio创建一个新的.Net Core Console应用程序: ![](images/create-new-net-core-console-application.png) -### Install Volo.Abp Package +### 安装 Volo.Abp 包 -Volo.Abp.Core is the core nuget package to create ABP based applications. So, install it to your project: +Volo.Abp.Core是创建基于ABP的应用程序的核心nuget包. 所以,将它安装到您的项目中: ```` Install-Package Volo.Abp.Core ```` -### Create First ABP Module +### 创建第一个ABP模块 -ABP is a modular framework and it requires a **startup (root) module** class derived from ``AbpModule``: +ABP是一个模块化框架, 它需要一个从``AbpModule``类派生的 **启动(根)模块** 类: ````C# using Microsoft.Extensions.DependencyInjection; @@ -33,11 +33,11 @@ namespace AbpConsoleDemo } ```` -``AppModule`` is a good name for the startup module for an application. +``AppModule`` 是应用程序启动模块的好名称. -### Initialize The Application +### 初始化应用程序 -The next step is to bootstrap the application using the startup module created above: +下一步是使用上面创建的启动模块引导应用程序: ````C# using System; @@ -62,11 +62,11 @@ namespace AbpConsoleDemo ```` -``AbpApplicationFactory`` is used to create the application and load all modules taking ``AppModule`` as the startup module. ``Initialize()`` method starts the application. +``AbpApplicationFactory`` 用于创建应用程序并加载所有以``AppModule``作为启动模块的模块. ``Initialize()``方法启动应用程序. ### Hello World! -The application above does nothing. Let's create a service does something: +上面的应用程序什么都不做, 让我们创建一个服务做一些事情: ````C# using System; @@ -85,9 +85,9 @@ namespace AbpConsoleDemo ```` -``ITransientDependency`` is a special interface of ABP that automatically registers the service as transient (see [dependency injection document](Dependency-Injection.md)). +``ITransientDependency``是ABP的一个特殊接口, 它自动将服务注册为**Transient**(参见[依赖注入文档](Dependency-Injection.md)). -Now, we can resolve the ``HelloWorldService`` and say hello. Change the Program.cs as shown below: +现在,我们可以解析``HelloWorldService``并调用``SayHello``. 更改Program.cs, 如下所示: ````C# using System; @@ -104,7 +104,7 @@ namespace AbpConsoleDemo { application.Initialize(); - //Resolve a service and use it + // 解析服务并使用它 var helloWorldService = application.ServiceProvider.GetService(); helloWorldService.SayHello(); @@ -117,8 +117,8 @@ namespace AbpConsoleDemo } ```` -While it's enough for this simple code example, it's always suggested to create scopes in case of directly resolving dependencies from ``IServiceProvider`` (TODO: see DI documentation). +这对于这个简单的代码示例已足够, 如果是直接从``IServiceProvider``解析建议创建**Scoped**依赖.(参见[依赖注入文档](Dependency-Injection.md)). -### Source Code +### 源码 -Get source code of the sample project created in this tutorial from [here](../samples/BasicConsoleApplication). +从[这里](../samples/BasicConsoleApplication)获取本教程中创建的示例项目的源代码. \ No newline at end of file