mercredi 10 juin 2020

GET Collection By Type or String

I am using reflection to dynamically generate forms in my application. When dealing with properties that have relationships I need to be able to dynamically call a collection.

How can I replace:

foreach (Customer c in Db.Customers)
{

}

With something like this:

foreach (dynamic d in Db["Customers"])
{

}

or like this

foreach (dynamic d in Db.typeof(Customer))
{

}




Aucun commentaire:

Enregistrer un commentaire