zoukankan      html  css  js  c++  java
  • abp vnext仓储模块——对ado.net驱动的封装实现。

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

     
    又见阿郎的主页又见阿郎 初学一级 | 园豆:170
    提问于: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();
            }
        }
    }
  • 相关阅读:
    使用SocketAsyncEventArgs犯的低级错误
    使用Beetle简单构建高性能Socket tcp应用
    构造BufferWriter和BufferReader实现高效的对象序列化和反序列化
    c#编写高性能Tcp Socket应用注意事项
    文件上传下载流程设计
    识别支点
    interface 与 delegate
    小知识:ADO.NET中的连接池
    解决问题
    IBM把Rational这个软件彻底给毁了
  • 原文地址:https://www.cnblogs.com/ybsport/p/12321106.html
Copyright © 2011-2022 走看看