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

Adds and implements conventions for model builder configuration #2961

Closed
wants to merge 5 commits into from

Conversation

Grinderofl
Copy link
Contributor

Adds the ability to configure ModelBuilder from outside OnModelCreating method of DbContext.

Previous versions of EF lacked a proper way of doing it, this implementation gives the ability to add multiple IModelBuilderConvention types for configuration to individual/differing DbContext types. Dependency Injection is also supported.

Also sort-of solves #2805.

services.AddEntityFramework()
    .AddDbContext<Context>(builder => builder.UseConvention<MyBuilderConvention>());


public class MyBuilderConvention : IModelBuilderConvention
{
    public void Apply(ModelBuilder modelBuilder)
    {
        // (...);
    }
}

@dnfclas
Copy link

dnfclas commented Aug 29, 2015

Hi @Grinderofl, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
We will now validate the agreement and then real humans will evaluate your PR.

TTYL, DNFBOT;

@AndriySvyryd
Copy link
Member

@Grinderofl
Thanks for sending this PR. We've discussed it and arrived at the conclusion that the API needs to be more flexible to be useful for more scenarios, see #2992
This is something that we plan to address before RTM, but you are free to send another PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants