EntityFrameworkCore.Extension.AutoMapping 1.0.0

dotnet add package EntityFrameworkCore.Extension.AutoMapping --version 1.0.0                
NuGet\Install-Package EntityFrameworkCore.Extension.AutoMapping -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EntityFrameworkCore.Extension.AutoMapping" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EntityFrameworkCore.Extension.AutoMapping --version 1.0.0                
#r "nuget: EntityFrameworkCore.Extension.AutoMapping, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EntityFrameworkCore.Extension.AutoMapping as a Cake Addin
#addin nuget:?package=EntityFrameworkCore.Extension.AutoMapping&version=1.0.0

// Install EntityFrameworkCore.Extension.AutoMapping as a Cake Tool
#tool nuget:?package=EntityFrameworkCore.Extension.AutoMapping&version=1.0.0                

EntityFrameworkCore.Extension.AutoMapping

一款EntityFrameworkCore自动映射数据实体类到数据库上下文的扩看类,并且支持abp和abp vnext的自动注入实体对应的仓储类(Repository)

如何使用(How to use)

在DbContext.cs中重写OnModelCreating方法:

using EntityFrameworkCore.Extension;
... //此处省略其它代码
public class XmateDbContext:DbContext
{
  ... //此处省略其它代码
  protected override void OnModelCreating(ModelBuilder modelBuilder)
  {
    var modelAssemblyName = "XMate.Models";//实体类所在类库的名称,不包含扩展名(.dll)
    modelBuilder.AutoMappingEntityTypes(modelAssemblyName);
    base.OnModelCreating(modelBuilder);//这个必须加,否则报错
    
    ...//此处省略其它代码
  }
}

在Abp中实现自动注入实体类对应的Repository

using EntityFrameworkCore.Extension.AutoMapping.Abp;
... //此处省略其它代码
public class XmateModule:AbpModule
{
  ... //此处省略其它代码
  //重写Initialize方法
  public override void Initialize()
  {
      ... //此处省略其它代码
      var modelAssemblyName = "XMate.Models";//实体类所在类库的名称,不包含扩展名(.dll)
      IocManager.RegisterDbEntityRepositories(modelAssemblyName);
  }
}

在Abp VNext中实现自动注入实体类对应的Repository

using EntityFrameworkCore.Extension.AutoMapping.AbpVNext;
... //此处省略其它代码
public class XmateModule:AbpModule
{
  ... //此处省略其它代码
  //重写ConfigureServices方法
  public override void ConfigureServices(ServiceConfigurationContext context)
  {
      ... //此处省略其它代码
      var modelAssemblyName = "XMate.Models";//实体类所在类库的名称,不包含扩展名(.dll)
      context.Services.RegisterDbEntityRepositories(modelAssemblyName);
  }
}

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on EntityFrameworkCore.Extension.AutoMapping:

Package Downloads
EntityFrameworkCore.Extension.AutoMapping.Abp

一款EntityFrameworkCore自动映射数据实体类到数据库上下文的扩看类,并且支持abp和abp vnext的自动注入实体对应的仓储类(Repository)

EntityFrameworkCore.Extension.AutoMapping.AbpVNext

一款EntityFrameworkCore自动映射数据实体类到数据库上下文的扩看类,并且支持abp和abp vnext的自动注入实体对应的仓储类(Repository)

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 280 11/9/2022

一款EntityFrameworkCore自动映射数据实体类到数据库上下文的扩看类,并且支持abp和abp vnext的自动注入实体对应的仓储类(Repository)