mardi 18 août 2020

Reflection. I need to buld my DB model dinamically in ASP.NET core MVC

How to set link OnModelCreating like this:

modelBuilder.Entity<TESTS_QUESTIONS>().HasMany(e => e.TESTS_ANSWERS).WithOne(e => e.TEST_QUESTION_DATA).HasForeignKey(e => e.TEST_QUESTION);

using reflection?

I try something like this:

object oo = includedObjects.GetType().GetMethod("Entity", new Type[] { typeof(TESTS_QUESTIONS) }).Invoke(includedObjects, new object[] { "e => e.TESTS_ANSWERS" });




Aucun commentaire:

Enregistrer un commentaire