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

IConceptualModelConvention<NavigationProperty> #459

Closed
maxbundchen opened this issue Jul 25, 2014 · 1 comment
Closed

IConceptualModelConvention<NavigationProperty> #459

maxbundchen opened this issue Jul 25, 2014 · 1 comment
Milestone

Comments

@maxbundchen
Copy link

Not sure if it will be implemented or not in EF7 but it's a nice feature in eF6.

We use this class to customize the use of EF6 and it saves a lot of work in a huge domain (200+ entities):

public class CustomDatabaseConventions :
    Convention,
    IConceptualModelConvention<NavigationProperty>
{
    public ConvencoesDatabase()
    {
        this.Types().Configure(t => t.SetCustomSchema());

        this.Properties().Configure(p => p.HasColumnName(p.ClrPropertyInfo.Name.ToLower()));
    }

    public void Apply(NavigationProperty property, DbModel model)
    {
        var clrPropertyInfo = property.MetadataProperties["ClrPropertyInfo"].Value as PropertyInfo;
        if (clrPropertyInfo.GetCustomAttribute<CustomCascadeDeleteAttribute>() != null)
            property.FromEndMember.DeleteBehavior = OperationAction.Cascade;
    }
}
@rowanmiller
Copy link
Contributor

Hey Max,

We have #214 tracking the need to be able to create custom conventions. Metadata is a lot simpler/easier in EF7, so the API for custom conventions will be different. It may even just be a hook to manipulate the metadata model at different points in the pipeline. The scenarios you listed will be possible (and probably simpler).

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
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

No branches or pull requests

3 participants