I have a list 30 model classes and I have to do the following actions for each class:
private static IEdmModel GetEdmModel(IServiceProvider serviceProvider)
{
var odataBuilder = new ODataConventionModelBuilder(serviceProvider);
odataBuilder
.EntitySet<AnswerCondition>("AnswerConditions")
.EntityType
.Select()
.Expand()
.OrderBy()
.Filter()
.Count();
Now I want to have a list of keys-values and do this action inside a for loop:
var list = new List<KeyValuePair<string, Type>>() {
new KeyValuePair<string, Type>("ActionTypes", typeof(ActionType)),
new KeyValuePair<string, Type>("AnswerConditions", typeof(AnswerCondition)),
.
.
.
};
foreach (KeyValuePair<string, Type> item in list)
{
string address = item.Key;
Type t = item.Value;
odataBuilder
.EntitySet<t>(address)
.EntityType
.Select()
.Expand()
.OrderBy()
.Filter()
.Count();
}
But it shows an error for t
't' is a variable but is used like a type
How can I store list of classes in a variable and used them later as generic type?