首页 新闻 会员 周边 捐助

abp vnext仓储模块——对ado.net驱动的封装实现。

0
悬赏园豆:10 [待解决问题]

abp vnext仓储(Repository)模块的代码有对内存数据库、EFCore ORM、mongodb等的封装,但是没有ADO.NET驱动的适配和封装。有人有了解么?

又见阿郎的主页 又见阿郎 | 初学一级 | 园豆:163
提问于:2020-02-17 09:29
< >
分享
所有回答(1)
0

没用过 abp vnext

EF就是对ASP.NET ADO 的封装,感觉是支持的,具体怎么注入 绑定的要分析下源码 EF就是那个样子
abp vnext 太高级,对小白不友好,我自己写了一个 目前用的还算合适,太高级对我来说不算友好

随手贴一下
https://github.com/abpframework/abp/blob/dev/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/EntityFrameworkCore/DashboardDemoDbContext.cs

using Microsoft.EntityFrameworkCore;
using DashboardDemo.Users;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Volo.Abp.Users.EntityFrameworkCore;

namespace DashboardDemo.EntityFrameworkCore
{
    /* This is your actual DbContext used on runtime.
     * It includes only your entities.
     * It does not include entities of the used modules, because each module has already
     * its own DbContext class. If you want to share some database tables with the used modules,
     * just create a structure like done for AppUser.
     *
     * Don't use this DbContext for database migrations since it does not contain tables of the
     * used modules (as explained above). See DashboardDemoMigrationsDbContext for migrations.
     */
    [ConnectionStringName("Default")]
    public class DashboardDemoDbContext : AbpDbContext<DashboardDemoDbContext>
    {
        public DbSet<AppUser> Users { get; set; }

        /* Add DbSet properties for your Aggregate Roots / Entities here.
         * Also map them inside DashboardDemoDbContextModelCreatingExtensions.ConfigureDashboardDemo
         */

        public DashboardDemoDbContext(DbContextOptions<DashboardDemoDbContext> options)
            : base(options)
        {

        }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            /* Configure the shared tables (with included modules) here */

            builder.Entity<AppUser>(b =>
            {
                b.ToTable("AbpUsers"); //Sharing the same table "AbpUsers" with the IdentityUser

                b.ConfigureFullAudited();
                b.ConfigureExtraProperties();
                b.ConfigureConcurrencyStamp();
                b.ConfigureAbpUser();

                //Moved customization to a method so we can share it with the DashboardDemoMigrationsDbContext class
                b.ConfigureCustomUserProperties();
            });

            /* Configure your own tables/entities inside the ConfigureDashboardDemo method */

            builder.ConfigureDashboardDemo();
        }
    }
}

家秋 | 园豆:475 (菜鸟二级) | 2020-02-17 11:23

你这个示例代码应该还是EF把。有没有就是仓储层是基于ado.net,而不是ef或是efcore去操作数据库。

支持(0) 反对(0) 又见阿郎 | 园豆:163 (初学一级) | 2020-02-18 09:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册