I have a project in MVC C# code-first. I want to pass a type to my method. And my method needs a class to work. But I don't want to pass a class - I want it to be dynamic. Is it possible or not?
Here is my codes;
string item ="PERSON" // item is a parametric I give the table name to get the type of table
Assembly asm = Assembly.Load("ProjectName");
Type entityType = asm.GetType(String.Format("NameSpace.Model.{0}", item));
var test = LINQDynamic<>.GetQueryResult(ssa,entityType,ddd); // In LINQDynamic<> I want to use entityType like that LINQDynamic<entityType> but it's not acceptable what can I make the convert type to generic?..Because table name is parametric.Is it possible to convert that type?
public class LINQDynamic<TEntity> where TEntity: class
{
public static object GetQueryResult(object pkKey,Type type, params object[] pkKeys)
{
//TODO
}
}