I have a project in MVC C# code-first.I want to pass type to my method.And my method needs to class to work.But I don't want to pass class I want dynamic.I don't know 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
}
}
Aucun commentaire:
Enregistrer un commentaire