I have an extesion method with the following signature
public static void AddConfiguration<TEntity>(this ModelBuilder builder, EntityTypeConfiguration<TEntity> configuration)
where TEntity : class
{
...
}
I want to pass the parameter via Reflection and tried this method:
var ctors = type.GetConstructors(BindingFlags.Public);
modelBuilder.AddConfiguration(ctors[0].Invoke(new object[] { }));
And this way:
modelBuilder.AddConfiguration(Activator.CreateInstance(type));
Both return an object
so the method does not accept them. Is there any way to do that?
Aucun commentaire:
Enregistrer un commentaire