Any plans to support IDesignTimeDbContextFactory?

edited December 2018
Hello. There is a DbContextPooling support appeared in EF Core 2.0 (https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-2.0#dbcontext-pooling) which requires that DbContext class has only one constructor. So to be able load implemented DbContext in LinqPad I need other implementation, that accept connection string (as there are no app.config file for .net core project). There are recommended way for design-time DbContext instantiation with design-time connection string (https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dbcontext-creation). Do you have any plans to support IDesignTimeDbContextFactory in future?

Comments

  • Does it help if you make the constructor for LINQPad protected instead of public?
  • Yes, it helps, thank you. But I decided to pick another approach, and created separated DesignTimeDatabaseContext, derived from primary DatabaseContext in order to separate any design-time information from main context. For example:
    - OnConfiguring method, needed for LinqPad only
    - All DbSet properties, as we have only aggregation roots in main context, but it is more handy to have all DbSets in design-time to access from LinqPad.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!