Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调整IServiceCollection.AddOsharpDbContext<TDbContext>()的执行位置 #225

Closed
gmf520 opened this issue Apr 2, 2021 · 0 comments
Closed
Labels
Breaked Changes ⚡ 更新有破坏性,对现有业务实现有较大影响 Feature 🔨 新功能,新特性 Finished ✔️ 实现并完工
Milestone

Comments

@gmf520
Copy link
Member

gmf520 commented Apr 2, 2021

您的功能请求与现有问题有关吗?请描述

EntityFrameworkCorePackBase中强行注入DefaultDbContext不合理,如果不使用DefaultDbContext的时候,会造成混乱

描述您想要的需求方案

  • 移除EntityFrameworkCorePackBase中的上下文注入

    public abstract class EntityFrameworkCorePackBase : OsharpPack
    {
        public override IServiceCollection AddServices(IServiceCollection services)
        {
            // services.AddOsharpDbContext<DefaultDbContext>();
        }
    }
    
  • 改到MigrationPackBase<TDbContext>基类中执行上下文类型的注入

    public abstract class MigrationPackBase<TDbContext> : OsharpPack
    where TDbContext : DbContext
    {
        public override IServiceCollection AddServices(IServiceCollection services)
        {
            services.AddOsharpDbContext<TDbContext>();
            return services;
        }
    }
    
@gmf520 gmf520 added Feature 🔨 新功能,新特性 Breaked Changes ⚡ 更新有破坏性,对现有业务实现有较大影响 labels Apr 2, 2021
@gmf520 gmf520 added this to the v5.0.4 milestone Apr 2, 2021
@gmf520 gmf520 added the Finished ✔️ 实现并完工 label Apr 2, 2021
@gmf520 gmf520 closed this as completed Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaked Changes ⚡ 更新有破坏性,对现有业务实现有较大影响 Feature 🔨 新功能,新特性 Finished ✔️ 实现并完工
Projects
None yet
Development

No branches or pull requests

1 participant