Code Monkey home page Code Monkey logo

myfirstabp's Introduction

MyFirstABP

第一个 ABP项目,利用abp实现了人员的查询和显示,并使用丝袜哥Swagger生成接口列表。

本代码为《基于DDD的ABP开发框架初探》(https://www.cnblogs.com/Leo_wl/p/5503992.html) ,其中存在一些问题而无法编译运行。本代码修正了其中的问题,并简单增加了扩展。 从http://www.aspnetboilerplate.com 下载模板后,建议使用vs2017进行nuget包还原和后续开发,使用其他vs版本可能存在这样那样的问题。

使用步骤:

1、用vs2017打开项目,将FirstABP.Web设为启动项目;

2、点击“生成”菜单下的"重新生成解决方案";

3、在程序包控制台中,项目选择 FirstABP.EntityFramework, 输入命令   update-database ;

4、运行查询结果。

界面效果如下:

查看接口

用户数据如下:

姓名 年龄

xmm 25

longhao 25

Jerry.Core 25

Joye.NET 25

对 原文的改进之处有四:

1、修改映射未初始化的错误- Mapper not initialized。

在ABP官网下载模板时,未勾选“Include module-zero”。在新增实体及相应业务逻辑后运行网站时,可能会出现” Mapper not initialized. Call Initialize with appropriate configuration…”。

【原因】Mapper not initialized 映射未初始化

【解决】在ApplicationModule类中增加依赖typeof(AbpAutoMapperModule)即可。

[DependsOn(typeof(DemoCoreModule), typeof(AbpAutoMapperModule))]

2、完善FirstABP.Application.DTO 的GetAllPeopleOutput 和 PersonDto;

3、在前台中列表展示人员数据。

4、利用丝袜哥Swagger生成接口列表,nuget引用Swashbuckle,参考文章为http://www.cnblogs.com/wer-ltm/p/5776024.html#autoid-0-4-0 ,说明:

(1)、 EnableSwaggerUi中InjectJavaScript的是translator.js, 要将translator 属性设置为嵌入式资源,而不是swagger.js。设置swagger.js为嵌入式资源是无法显示中文的。

(2)、注释是加在服务层项目的接口类(如FirstABP.Application项目的IPersonService类)中的每个方法上;

myfirstabp's People

Contributors

yuchen1030 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.