Skip to content

Why Microsoft.EntityFrameworkCore.Design is not included in WebUI? #690

Answered by lwestfall
GianlucaLocri asked this question in Q&A
Discussion options

You must be logged in to vote

(Not the owner of this repo) What I do instead is implement a custom IDesignTimeDbContextFactory in the Infrastructure project, and omit the --startup-project argument. I have two separate codebases that this works really well for. Here's a sample (had to remove a few proprietary details, so there may be an error or two).

Doing this will eliminate the need to reference Microsoft.EntityFrameworkCore.Design in your WebUI project.

(PS if someone smarter than me sees pitfalls here - please lmk!)

public class MyAwesomeDbContextFactory : IDesignTimeDbContextFactory<MyAwesomeDbContext>
{
    public MyAwesomeDbContext CreateDbContext(string[] args)
    {
        // sample migration add command (r…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@GianlucaLocri
Comment options

@GianlucaLocri
Comment options

@lwestfall
Comment options

Answer selected by GianlucaLocri
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants