怎么做免费网站推,科技之星,信誉好的龙岗网站设计,万能本地视频播放器文章目录 项目地址一、Restaurants.Domain 核心业务层1.1 Entities实体层1.2 Repositories 数据操作EF的接口二、Restaurants.Infrastructure 基础设施层2.1 Persistence 数据EF CORE配置2.2 Repositories 数据查询实现2.3 Extensions 服务注册三、Restaurants.Application用例… 文章目录 项目地址一、Restaurants.Domain 核心业务层1.1 Entities实体层1.2 Repositories 数据操作EF的接口 二、Restaurants.Infrastructure 基础设施层2.1 Persistence 数据EF CORE配置2.2 Repositories 数据查询实现2.3 Extensions 服务注册 三、Restaurants.Application用例层3.1 RestaurantsUseCase 餐厅用例3.2 Interfaces 接口3.3 Extensions 服务注册 项目地址
教程作者:教程地址:代码仓库地址:所用到的框架和插件:dbt
airflow一、Restaurants.Domain 核心业务层 独立于框架和数据库,最基础的实体业务和对接数据库查询方法的接口 1.1 Entities实体层
业务核心数据表的实体
1.2 Repositories 数据操作EF的接口
数据库里需要执行的所有查询方法的接口,之所以在Domain层,可以理解和实体表相关的数据库操作都在这里,所以这里的所有接口的都有2个功能: 该接口用于被Infrastructure里的继承,然后实现具体的EF数据库操作,例如查询,删除等;用来注册服务,①的EF具体操作实现后,就可以直接通过注册服务,给Application里的UseCase使用; IRestaurantsRepository.cs 二、Restaurants.Infrastructure 基础设施层 数据库访问以及外部API适配 2.1 Persistence 数据EF CORE配置
EF的上下文配置,这里是SQLRestaurantsDbContext.csusing Microsoft.EntityFrameworkCore;
using Restaurants.Domain.Models;namespace Restaurants.Infrastructure.Persistence
{internal class RestaurantsDbContext: DbContext{public RestaurantsDbContext(DbContextOptionsRestaurantsDbContext options):base(options){ }public DbSetRestaurant Restaurants { get; set; }public DbSetDish Dishes { get; set; }protected override void OnModelCreating(ModelBuilder modelBuilder) {base.OnModelCreating(modelBuilder);modelBuilder.Entity