abp learning (three) - Translation of a document

Address: https: //aspnetboilerplate.com/Pages/Documents

What is ASP.NET model?
ASP.NET Boilerplate (ABP) is an open source and fully document application framework. It is not only a framework, but also provides a powerful architecture model based on domain-driven design, taking into account all of the best practices.

ABP used with the latest ASP.NET Core and EF Core, but also supports ASP.NET MVC 5.x and EF6.x.

A Quick Sample

Let's investigate a simple class to see ABP's benefits:

Let's look at a simple class to understand the benefits of ABP:

public class TaskAppService : ApplicationService, ITaskAppService
{
    private readonly IRepository<Task> _taskRepository;

    public TaskAppService(IRepository<Task> taskRepository)
    {
        _taskRepository = taskRepository;
    }

    [AbpAuthorize(MyPermissions.UpdateTasks)]
    public async Task UpdateTask(UpdateTaskInput input)
    {
        Logger.Info("Updating a task for input: " + input);

        var task = await _taskRepository.FirstOrDefaultAsync(input.TaskId);
        if (task == null)
        {
            throw new UserFriendlyException(L("CouldNotFindTheTaskMessage"));
        }

        ObjectMapper.MapTo(input, task);
    }
}

Here, we see a sample application service method. The presentation layer is performed by an application in an application service used directly in DDD. The UpdateTask deemed JavaScript method called through AJAX.

Let's see here some of the benefits of ABP:

Dependency Injection:

ABP to use and provide regular DI infrastructure. Because this is an application service, which is registered as it is often transient (created upon request) to the DI container. It can simply inject any dependencies (e.g. in this example IRepository <Task>).

Repository:

ABP can create a default storage (e.g. in this example IRepository <Task>) for each entity. Default repository have many useful methods, e.g. FirstOrDefault methods used in this example. We can extend the default repository to meet our needs. Abstract repository DBMS and ORM, and simplifies the data access logic.

Authorization:

ABP can declare check permissions. If the current user does not have "Update Tasks" permission or not logged on, it blocks access to UpdateTask method. ABP not only declarative attributes, but also has other unauthorized manner.

verification:

ABP automatically checks whether the input is empty. It is also based on the standard data annotation attributes and all attributes custom validation rules to validate input. If the request is invalid, it throws an appropriate exception handling authentication at the client.

Audit Logging:

User, browser, IP address, service calls, methods, parameters, call time, duration, and perform some other information will be automatically saved for each request by convention and configuration.

Unit of work:

In ABP, the default method for each application services are assumed to be the work unit. It automatically creates a connection and start a transaction when the method begins. If the process is completed successfully, without exception, will commit the transaction and release the connection. This method uses even different repositories or a method, which will be atoms (transactional). After the transaction is committed, it will automatically save all changes to the entity. We do not even call shown above _repository.Update (task) method.

Exception Handling:

We almost do not need to manually handle exceptions in the ABP Web application. By default, all exceptions are handled automatically! If an exception occurs, ABP will automatically log the exception and the right results back to the client. For example, if this is an AJAX request, it returns to the client a JSON object, indicating an error. Unless used in this example is UserFriendlyException abnormal, otherwise it will hide the actual exception to the client. It also understand and deal with client error, appropriate message is displayed to the user.

Logging:

As you can see, we can write the log using the Logger object defined in the base class. Log4Net used by default, but can be changed and it is configurable.

Localization:

Please note that when an exception is thrown we use "L" method? In this way, it will automatically localized based on the current user's culture. For more information, see the localized documentation.

Automatic Mapping:

In the last line, we use IObjectMapper of ABP MapTo method of mapping input. Attributes to entity attributes. It uses AutoMapper library to perform the mapping. We can easily attribute mapping according to the naming convention from one object to another.

Dynamic API layer:

In fact, TaskAppService is a simple class. In general, we have to write a wrapper API to control methods to JavaScript clients, but ABP performed automatically at runtime. In this way, we can use the method of application services directly from the client.

Evaluation: Good Advanced ah ..................

Dynamic JavaScript AJAX proxy:

ABP create a proxy method, the calling application service method is as simple as calling a JavaScript method on the client.

 

 

We can see the benefits of ABP in this simple class. All of these tasks often spend a lot of time, but will be handled automatically by the framework.

In addition to this simple example, ABP also modular, multi-tenant, caching, background jobs, data filters, settings management, field events, unit and integration testing provides a powerful infrastructure and development model. You focus on your business codes do not repeat yourself!

getting Started

You can start from a template or start a tutorial that introduces.

Startup Templates

Directly create a modern looking startup project from the startup templates.

Create the appearance of modern boot directly from the project start template.

Start templates provide the basic layout and some common functionality to your application. There are several different options have to start template.

ASP.NET Core
ASP.NET MVC 5.x

See the download page for other combinations.

For additional combinations, see the download page.

 

Introduction Tutorials (Start Tutorial)

Step by step tutorials introduces the framework and explains how to create your application based on the startup templates.

Step by step tutorial introduces the framework, and explains how to create an application-based startup template.

ASP.NET Core
ASP.NET MVC 5.x

The Samples (Samples example)

There are many sample projects developed with the framework. See the samples page.

The framework developed a number of example projects. See the examples page.

Community (Community)

This is an open source project and open to contributions from the community.

This is an open source project, welcomed the contribution of the community.

 

 

Summary: This is the first page of the document content translation, content, and the second article:

very similar. The first page of the document introduces a bit Content:

 

1, said the concept of abp;

2, give a code sample, include the benefits of using the code according to exemplary abp;

3, which lists the abp provides templates;

4, citing a connection introductory tutorial, you can start learning abp according introductory tutorial step by step;

5, lists exemplary project url addresses;

6, introduced community-related information, can participate in the development of abp. Project on github.

 

Dependency injection: ABP using conventional DI and provide infrastructure. Because this is an application service, which is registered as it is often transient (created upon request) to the DI container. It can simply inject any dependencies (e.g. in this example IRepository <Task>). Repository: ABP can create a default storage (e.g. in this example IRepository <Task>) for each entity. Default repository have many useful methods, e.g. FirstOrDefault methods used in this example. We can extend the default repository to meet our needs. Abstract repository DBMS and ORM, and simplifies the data access logic. Authorization: ABP can declare check permissions. If the current user does not have "Update Tasks" permission or not logged on, it blocks access to UpdateTask method. ABP not only declarative attributes, but also has other unauthorized manner. Verify: ABP automatically checks whether the input is empty. It is also based on the standard data annotation attributes and all attributes custom validation rules to validate input. If the request is invalid, it throws an appropriate exception handling authentication at the client. Audit Logging: user, browser, IP address, service calls, methods, parameters, call time, duration, and perform some other information will be automatically saved for each request by convention and configuration. Unit of work: in the ABP, by default, each application service methods are assumed to be the work unit. It automatically creates a connection and start a transaction when the method begins. If the process is completed successfully, without exception, will commit the transaction and release the connection. This method uses even different repositories or a method, which will be atoms (transactional). After the transaction is committed, it will automatically save all changes to the entity. We do not even call _repository shown above. Update (task) method. Exception Handling: We almost do not need to manually handle exceptions in the ABP Web application. By default, all exceptions are handled automatically! If an exception occurs, ABP will automatically log the exception and the right results back to the client. For example, if this is an AJAX request, it returns to the client a JSON object, indicating an error. Unless used in this example is UserFriendlyException abnormal, otherwise it will hide the actual exception to the client. It also understand and deal with client error, appropriate message is displayed to the user. Logging: As you can see, we can write the log using the Logger object defined in the base class. Log4Net used by default, but can be changed and it is configurable. Localization: Please note that when an exception is thrown we use "L" method? In this way, it will automatically localized based on the current user's culture. For more information, see the localized documentation. Automatic mapping: In the last line, we use IObjectMapper of ABP MapTo method of mapping input. Attributes to entity attributes. It uses AutoMapper library to perform the mapping. We can easily attribute mapping according to the naming convention from one object to another. Dynamic API layer: in fact, TaskAppService is a simple class. In general, we have to write a wrapper API to control methods to JavaScript clients, but ABP performed automatically at runtime. In this way, we can use the method of application services directly from the client. Evaluation: Good ah .................. advanced dynamic JavaScript AJAX proxy: ABP create the proxy method, the calling application service method is as simple as calling a JavaScript method on the client. In the last line, we use IObjectMapper of ABP MapTo method of mapping input. Attributes to entity attributes. It uses AutoMapper library to perform the mapping. We can easily attribute mapping according to the naming convention from one object to another. Dynamic API layer: in fact, TaskAppService is a simple class. In general, we have to write a wrapper API to control methods to JavaScript clients, but ABP performed automatically at runtime. In this way, we can use the method of application services directly from the client. Evaluation: Good ah .................. advanced dynamic JavaScript AJAX proxy: ABP create the proxy method, the calling application service method is as simple as calling a JavaScript method on the client. In the last line, we use IObjectMapper of ABP MapTo method of mapping input. Attributes to entity attributes. It uses AutoMapper library to perform the mapping. We can easily attribute mapping according to the naming convention from one object to another. Dynamic API layer: in fact, TaskAppService is a simple class. In general, we have to write a wrapper API to control methods to JavaScript clients, but ABP performed automatically at runtime. In this way, we can use the method of application services directly from the client. Evaluation: Good ah .................. advanced dynamic JavaScript AJAX proxy: ABP create the proxy method, the calling application service method is as simple as calling a JavaScript method on the client.
[Yīlài zhùrù: ABP shǐyòng Bing tígōng chángguī a jīchǔ jiégòu. This Yóuyú CI Lei Shi Zhong yìngyòng chéngxù fúwù, yīncǐ tōngcháng Jiang Qi zuòwéi Shun Tai (gēnjù qǐngqiú chuàngjiàn) zhùcè Dao DI róngqì. Any that jiǎndān zhùrù rènhé yīlài Xiang (lìrú Ben shìlì Zhong IRepository <Task>). Cúnchú: ABP any that Wei Mei cut shítǐ chuàngjiàn mòrèn cúnchú (lìrú Ben shìlì Zhong IRepository <Task>). Mòrèn cúnchú jùyǒu xǔduō yǒuyòng fāngfǎ, lìrú Ben shìlì Zhong shǐyòng FirstOrDefault fāngfǎ. Women of any that kuòzhǎn mòrèn cúnchú this mǎnzú Women xūqiú. Cúnchú chōuxiàngle DBMS with ORM, Bing jiǎnhuàle shùjù fǎngwèn luójí. Shòuquán: ABP any that shēngmíng Xing jiǎnchá quánxiàn. Rúguǒ dāngqián yònghù méiyǒu "gēngxīn rènwù" quánxiàn huǒ Wei dēnglù, weigh zǔzhǐ fǎngwèn UpdateTask fāngfǎ.ABP bùjǐn shǐyòng shēngmíng Xing shǔxìng, erqie picking juyǒu qita FANGSHI shouquan. Yanzheng: ABP Zidong jiǎncha shuru shifǒu Wei Kong. Zhushi Shuju me two Jiyu biaozhǔn shǔxing revealed zì Dingyi yanzheng guize yanzheng shuru de suǒyǒu shǔxing drive. Ruguǒ qǐngqiu wuxiao, we yǐnfa shidang de yanzheng Yichang Jiang Bing Zai Jinxing chǔlǐ kehu Duan. Shenhe rizhi Jilu: Yonghu, liulǎn Qi, IP dizhǐ, Hujiao fuwu, fangfǎ, canshu, Hujiao Shijian, Zhixing chixu Shijian revealed qita yixie Hui Xinxi genju Yueding Wei Mei Ge revealed Peizhi Zidong bǎocun qǐngqiu. Gongzuo danyuan: Zai Zhong ABP, moren qingkuang Xia, Mei zhǒng Yingyong jiǎding Dou Wei chengxu fuwu fangfǎ danyuan gongzuo. TA Hui Zhidong chuangjian Yige Lianjie, Bing Zai Shi kaishǐ Yige Shiwu fangfǎ kaishǐ. Ruguǒ fangfǎ Gai Wu Wancheng Chenggong liwai aunt, Zé Jiang Bing Shifang Lianjie tijiao Shiwu. Jishǐ cǐ fangfǎ shǐyong Huo fangfǎ butong de cunchu periodicals, tamen dou jiang shi yuanzǐ de (Shiwu Xing de). Tijiao Shiwu Hou, Jiang Zidong bǎocun shitǐ de suǒyǒu genggǎi thigh. Wǒmen shenzhi offset diaoyong xuyao shangmian suǒ de_repository.Update Shi (task) fangfǎ. Yichang chǔlǐ: Wǒmen jihu offset Yingyong chengxu xuyao Web Zai Shang Zhong de Yichang shǒudong chǔlǐ ABP. Moren qingkuang Xia Zhidong chǔlǐ suǒyǒu duhui Yichang! Ruguǒ Fasheng Yichang, Yichang ABP Gai Hui Bing Jiang Zidong Jilu zhengque de jieguǒ fǎnhui kehu Duan GEI. Liru, Shi Zhe ruguǒ Yige qǐngqiu AJAX, we Jiang Duan Xiang kehu fǎnhui Yige duixiang JSON, zhǐshi Fasheng cuowu. Chufei Shili Gai Zhong Shi UserFriendlyException shǐyong de Yichang, fǒuze TA Xiang Jiang Duan yǐncang kehu Shiji de Yichang. Bing chǔlǐ liǎojie me two kehu duandi cuowu, Bing Xiang yonghu xiǎnshi shidang de Xiaoxi. Rizhi Jilu: suǒ holding Ru Jian, Lei Zhong Ji keyǐ shǐyong wǒmen Dingyi de Logger duixiang rizhi bianxie. Log4Net moren qingkuang shǐyong Xia, my people shi ke ke Peizhi de genggǎi welding. Bendi promise: Qǐng zhuyi, Zai Shi wǒmen yǐnfa Yichang shǐyongle "L" fangfǎ? Zheyang, Xie Hui Zhidong genju dangqian Jinxing Bendi yonghu de Wenhua promise. Geng Duo Yǒuguan Xinxi, qǐng canjian Bendi wendang promise. Zidong yingshe: Zai zuihou Yixing, wǒmen shǐyong ABP de IObjectMapper de MapTo fangfǎ yingshe shuru. Shǔxing dào shǔxing shitǐ. TA shǐyong AutoMapper Zhixing yingshe periodicals. Wǒmen keyǐ genju Yueding Mingming Jiang Qingsong de shǔxing freeze Yige duixiang yingshe dào Yige duixiang Ling. Dongtai Ceng API: Shiji Shang, Shi Yige TaskAppService jiǎndan de lei. Tongchang, wǒmen bixu bianxie baozhuang API, ability Qi Jiang fangfǎ gongkai yǐ JavaScript GEI kehu Duan Shi Hui danshi ABP Yunxing Zidong Zhixing Zai. Zhèyàng, wǒmen vast zhíjiē Congo Kehua Duane shǐyòng yìngyòng Chengxi fúwù fāngfǎ. Píngjià: Hǎo xiānjìn a .................. Dongtai JavaScript AJAX dàilǐ: ABP ChuangJie dàilǐ fāngfǎ links to diàoyòng yìngyòng Chengxi fúwù fāngfǎ Jiu Xian Zai Kehua Duane Shane diàoyòng JavaScript fāngfǎ Yiyang Jump.]
Dependency Injection:

ABP to use and provide regular DI infrastructure. Because this is an application service, which is registered as it is often transient (created upon request) to the DI container. It can simply inject any dependencies (e.g. in this example IRepository <Task>).

Repository:

ABP can create a default storage (e.g. in this example IRepository <Task>) for each entity. Default repository have many useful methods, e.g. FirstOrDefault methods used in this example. We can extend the default repository to meet our needs. Abstract repository DBMS and ORM, and simplifies the data access logic.

Authorization:

ABP can declare check permissions. If the current user does not have "Update Tasks" permission or not logged on, it blocks access to UpdateTask method. ABP not only declarative attributes, but also has other unauthorized manner.

verification:

ABP automatically checks whether the input is empty. It is also based on the standard data annotation attributes and all attributes custom validation rules to validate input. If the request is invalid, it throws an appropriate exception handling authentication at the client.

Audit Logging:

User, browser, IP address, service calls, methods, parameters, call time, duration, and perform some other information will be automatically saved for each request by convention and configuration.

Unit of work:

In ABP, the default method for each application services are assumed to be the work unit. It automatically creates a connection and start a transaction when the method begins. If the process is completed successfully, without exception, will commit the transaction and release the connection. This method uses even different repositories or a method, which will be atoms (transactional). After the transaction is committed, it will automatically save all changes to the entity. We do not even call shown above _repository.Update (task) method.

Exception Handling:

We almost do not need to manually handle exceptions in the ABP Web application. By default, all exceptions are handled automatically! If an exception occurs, ABP will automatically log the exception and the right results back to the client. For example, if this is an AJAX request, it returns to the client a JSON object, indicating an error. Unless used in this example is UserFriendlyException abnormal, otherwise it will hide the actual exception to the client. It also understand and deal with client error, appropriate message is displayed to the user.

Logging:

As you can see, we can write the log using the Logger object defined in the base class. Log4Net used by default, but can be changed and it is configurable.

Localization:

Please note that when an exception is thrown we use "L" method? In this way, it will automatically localized based on the current user's culture. For more information, see the localized documentation.

Automatic Mapping:

In the last line, we use IObjectMapper of ABP MapTo method of mapping input. Attributes to entity attributes. It uses AutoMapper library to perform the mapping. We can easily attribute mapping according to the naming convention from one object to another.

Dynamic API layer:

In fact, TaskAppService is a simple class. In general, we have to write a wrapper API to control methods to JavaScript clients, but ABP performed automatically at runtime. In this way, we can use the method of application services directly from the client.

Evaluation: Good Advanced ah ..................

Dynamic JavaScript AJAX proxy:

ABP create a proxy method, the calling application service method is as simple as calling a JavaScript method on the client.

Guess you like

Origin www.cnblogs.com/Tpf386/p/11840475.html