Skip to content

Be able to set the order in which the configuration is applied from the assembly #21304

Closed as not planned

Description

@sergiohms

What problem are you trying to solve?

When applying the entity types configuration using ApplyConfigurationsFromAssembly, I obtain an exception because an A entity's configuration depends on a B entity's configuration which is executed later. The exception message says I must set a shadow property to B (which I do) but since A's configuration is applied first, then it doesn't work. When I change B's name so that is is alphabetically ordered first than A, it works.

Describe the solution you'd like

I think the order could be specified by an attribute. Something like:

[EntityConfiguration(Order=0)]
public class PlayerConfiguration : IEntityTypeConfiguration<Player>
{
    public virtual void Configure(EntityTypeBuilder<Player> builder)
    {
        // ...
    }
}

Activity

  1. ajcvickers commented on Jun 22, 2020

    @ajcvickers
    Contributor

    @sgioh We're not big fans of assembly scanning for this in general--see comments on #13014 and #13088. We discussed the request here, but decided that we don't want to add additional features to the scanning code. Instead we recommend using your own scanner, as shown in the linked issues, where you can do whatever ordering, etc. is needed for your case.

  2. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions