EFDbProvider.EntityFramework 1.0.0.1

Install-Package EFDbProvider.EntityFramework -Version 1.0.0.1
dotnet add package EFDbProvider.EntityFramework --version 1.0.0.1
<PackageReference Include="EFDbProvider.EntityFramework" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EFDbProvider.EntityFramework --version 1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EFDbProvider.EntityFramework, 1.0.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install EFDbProvider.EntityFramework as a Cake Addin
#addin nuget:?package=EFDbProvider.EntityFramework&version=1.0.0.1

// Install EFDbProvider.EntityFramework as a Cake Tool
#tool nuget:?package=EFDbProvider.EntityFramework&version=1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

针对Ef6的仓储实现。EF+工作单元+Ado.Net。 特点: 1)每一个仓储实例就是一个工作单元,执行完数据库操作后统一提交数据,不用另外开关事务; 2)EF常规操作; 3)执行Sql语句查询返回DataTable并翻页; 4)Ado.Net执行Sql语句,并与仓储实例在同一个事务内。

如何使用? 1、创建DbContext。例如叫 MsSqlContext 2、创建仓储接口。例如叫 IRepositoryStore

public interface IRepositoryStore : IRepositoryBaseStore<DbContext>
{
       //如果自带的接口不能满足需求,则在此处扩展接口
}

3、实现仓储接口。例如叫 RepositoryStore

public class RepositoryStore : RepositoryBaseStore<DbContext>, IRepositoryStore
{
    public RepositoryStore(MsSqlContext context) : base(context)
    {
    }
}

4、所有的实体类都要继承IEntity接口,并且属性打上NotMapped标签

public class Model1 : IEntity
{
    public int Id { get; set; }
    //...

    [NotMapped]
    public object EfKeyId => Id;
}

5、使用 获取到仓储实例。(可以直接new,也可以注入) IRepositoryStore dbStore = new RepositoryStore(new MsSqlContext("ConnName"));

dbStore.Add(model1); dbStore.Update(model2);

//获取 DbContext var context = dbStore.Context;

//获取Ado.Net操作类,此操作类和dbStore是在同一个事务中。 var sqlHelper = dbStore.Context.SqlHelper();

//其他的操作

//最后再统一提交数据 var result = await dbStore.CommitAsync();

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.1 853 1/30/2018