public static MethodInfo CreateGenericSelectDirectMethod <T>(DBreeze.Transactions.Transaction tran, Type primaryPropertyType) { MethodInfo insertMethod = tran.GetType().GetMethods().Where(m => m.Name == "SelectDirect" && m.GetParameters().Length == 2).First(); Type valyeType = typeof(DbCustomSerializer <>).MakeGenericType(typeof(T)); MethodInfo selectMethodGeneric = insertMethod.MakeGenericMethod(primaryPropertyType, valyeType); return(selectMethodGeneric); }