AddMigration extension method for non-generic ITypeConfiguration
See original GitHub issueHey,
I try to manage my own MigrationSystem for registering migrations by XML model versions for my types. Therefore I’ve a Dictionary with type as key and a List of Migrations (classes based on IEnumerable<Action<XElement>>
) as value.
My problem is applying this migrations directly on ConfigurationContainer
is not possible because I don’t have generic ITypeConfiguration
objects. My algorithmn is:
- Manage my Migration in MigrationSystem (outside in a static configuration manner).
- Iterate over
ConfigurationContainer
and try to callAddMigration
forITypeConfiguration
- if a migration is configured for the type.
But ExtensionMethod AddMigration
can only be called for ITypeConfiguration<>
and not ConfigurationContainer
Enumerator values of type ITypeConfiguration
. I’ve also tried to directly use With<MigrationsExtension>.Apply()
but this is internal.
Currently workaround is applying migrations directly during creation of ContainerContainer
. Therefore I can call Type<>
and then AddMigration<>
. But this must be done for every type which feels wrong.
Does anyone have a better suggestion? Is it ok to provide a AddMigration extension method for ITypeConfiguration.
Regards Thomas
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Hey @Mike-E-angelo, thx a lot. My tests were successful. It think it should work with this new
AddMigration
methods. I’ll let you know in case I need anything else in next few days. But for now my demand is covered 😊As further suggestion: It should be possible to write an
AddMigration
method for non-generic version ofITypeConfiguration
like this. Therefore MigrationExtension must not be exposed. What do you think? Perhaps we could try this too.