https://aspnetboilerplate.com/Templates 创建项目之后,下载用Vs2019打开(vs2017不支持netcore3.0)结构如下:

一、

2、

在xx.core中新增实体类Code  codemapping

3、

在xx.core 中新增 仓储接口

4、在xx.EntityFrameWork中实现仓储

不要忘记在项目中上下文中做如下设置,否则执行add-migration 及update-database 时不会产生对应的表结构

 public class CodeMappingRepository:WuMingRepositoryBase<CodeMapping,int>,ICodeMappingRepository
{
public CodeMappingRepository(IDbContextProvider<WuMingDbContext> dbContextProvider) : base(dbContextProvider)
{
} public int Account()
{
throw new NotImplementedException();
}
}
public class CodeRepository :WuMingRepositoryBase<Code,int>,ICodeRepository
{
public CodeRepository(IDbContextProvider<WuMingDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}

5 .在xx.Application 定义Ixxservice 和实现实现接口

定义和实现:

ICodeAppService
public interface ICodeAppService: IApplicationService
{
List<Code> GetCodes(); void UpdateCode(Code entity); void CreateCode(Code entity); void DeleteCode(int Id);
}

CodeAppService:

  [AbpAllowAnonymous]
public class CodeAppService :WuMingAppServiceBase, ICodeAppService
{ ICodeRepository _CodeRepository;
ICodeMappingRepository _CodeMappingRepository; public CodeAppService(ICodeRepository CodeRepository, ICodeMappingRepository CodeMappingRepository)
{
_CodeRepository = CodeRepository;
_CodeMappingRepository = CodeMappingRepository;
} public void CreateCode(Code entity)
{
Logger.Info($"Created a User for entity at:{DateTime.Now}");
try
{
_CodeRepository.Insert(entity);
}
catch (Exception ex)
{
Logger.Error(ex.ToString());
}
} public void DeleteCode(int Id)
{
Logger.Info($"Created a User for entity at:{DateTime.Now}");
try
{
// _CodeRepository.Delete(new Code() { Id = Id }); }
catch (Exception ex)
{ Logger.Error(ex.ToString());
} } public List<Code> GetCodes()
{
Logger.Info($"Created a User for entity at:{DateTime.Now}");
try
{
//return _CodeRepository.GetAll().ToList();
return null;
}
catch (Exception ex)
{ throw;
}
} public void UpdateCode(Code entity)
{
Logger.Info($"Created a User for entity at:{DateTime.Now}");
try
{
// _CodeRepository.Update(entity); }
catch (Exception ex)
{ Logger.Error(ex.ToString());
}
}
}

6.设置项目启动项: F5 就可以看到api接口地址及接口描述

Abp添加新的接口(扩展底层接口)的更多相关文章

  1. typescript接口扩展、接口的继承

    //接口扩展:接口可以继承接口 // interface Animal{ // eat():void; // } // interface Person extends Animal{ // work ...

  2. Abp添加新的Api(不扩展底层方法)

    定义新的实体类:FileManage;继承 FullAuditedEntity<Guid> 在XX.Application 中定义IXXservice及实现XXservice public ...

  3. 添加新硬盘,扩展Centos7根分区

    ##背景介绍,系统安装时,分配的硬盘容量太小,根分区空间不够用,现添加一个新硬盘,通过以下步骤来扩展centos7根分区 [root@t201 ~]# df -h 文件系统 容量 已用 可用 已用% ...

  4. JEECMS 2.4.2 之添加新的可扩展的ftl模版文件、自定义方法

    Demo: <@cms.CfgList isPage='1' league='0' recommend='0' lala='0' hot='1' memberId='0' pageNo=page ...

  5. Android Telephony分析(六) ---- 接口扩展(实践篇)

    本文将结合前面五篇文章所讲解的知识,综合起来,实现一个接口扩展的功能.如果还没有阅读过前面五篇文章的内容,请先阅读:<Android Telephony分析(一) — Phone详解 >& ...

  6. typescript接口扩展

    /* typeScript中的接口 接口扩展 */ /* 接口的作用:在面向对象的编程中,接口是一种规范的定义,它定义了行为和动作的规范,在程序设计里面,接口起到一种限制和规范的作用.接口定义了某一批 ...

  7. Java EE HttpServletRequest接口和HttpServletResponse接口

    package javax.servlet.http (https://docs.oracle.com/javaee/7/api/javax/servlet/http/package-summary. ...

  8. Surface Pro 4 和 Surface Book 使用名为 Surface UEFI(统一可扩展固件接口)的新固件接口

    Surface Pro 4 和 Surface Book 使用名为 Surface UEFI(统一可扩展固件接口)的新固件接口.Surface UEFI 提供新功能,如启动更快速.安全性更高.可替换 ...

  9. 如何利用phpize在生产环境中为php添加新的扩展php-bcmath

    在日常的开发当中,随着开发的功能越来越复杂.对运行环境的要求也就随着需求的变化需要不断地更新和变化.一个在线的生产系统不可能一开始就满足了所有的运行依赖,因此动态地添加依赖就显得比较必要了.如果你的应 ...

随机推荐

  1. python3笔记二十三:正则表达式之元字符

    一:学习内容 匹配单个字符与数字:..[].^.\d.\D.\w.\W.\s.\S 匹配锚字符(边界字符):^.$.\A.\Z.\b.\B 匹配多个字符:(xyz) .x?.x*..*.x+.x{n} ...

  2. Nginx-rtmp点播之complex handshake

    1. 点播的配置 假设配置文件 nginx.conf 中对 rtmp 配置如下: # 创建的子进程数 worker_processes 1; #error_log logs/error.log; er ...

  3. Unexpected ConvertTo-Json results? Answer: it has a default -Depth of 2

    Unexpected ConvertTo-Json results? Answer: it has a default -Depth of 2 问题 Why do I get unexpected C ...

  4. Back键和Menu键程序退出弹窗以及按钮退出程序弹窗的实现

    MainActivity.java package com.loaderman.backmenudemo; import android.content.Intent; import android. ...

  5. oracle 导出关键字说明

    关键字       说明(默认) ----------------------------------------- UserId    用户名/口令 Full      导出整个文件(N) Buff ...

  6. Nginx OCSP

    #开启 vim  /path/to/path/conf/nginx.conf ..... events{ ...... 省略..... } http { ..... server{ listen 44 ...

  7. C#在DataGridView中自定义键盘功能——光标在单元格内具体位置

    //捕捉按键 protected override bool ProcessCmdKey(ref Message msg,Keys keyData) { if (keyData == Keys.Rig ...

  8. debian系统安装vsftpd服务端和ftp客户端

    一.服务器安装和配置 1.安装vsftpd.(此处切换到su权限下了.其它用户请使用sudo权限,没有sudo权限的看前面的教程进行安装) apt-get install vsftpd 2.配置vsf ...

  9. React Native 安装

    第一 :在天朝如果你可以违规上网的话便可以按 react native 中文网的文档进行安装与调试.地址为:https://reactnative.cn/docs/getting-started.ht ...

  10. Codeforces Round #594 (Div. 2)(A/B/C)

    A. Integer PointsDescription DLS and JLS are bored with a Math lesson. In order to entertain themsel ...