泛型方法与表达我有应该从表中返回的最后一条记录的一般方法:呼叫通过反射
public T FindLast<TKey>(Expression<Func<T,TKey>> specification = null)
{
return specification == null
? Set().LastOrDefault()
: Set().OrderBy(specification).LastOrDefault();
}
我需要通过反射
var methodCreateReadRepositoryAttr = (entityMetadata.GetEntityAttributeType() != null) ?
typeof(IRepositoryFactory).GetMethod("CreateReadRepository").MakeGenericMethod(entityMetadata.GetEntityAttributeType()) : null;
var methodEntityGet3 = attributeReadRepository.GetType().GetMethod("FindLast", new Type[] { typeof(Expression<Func<ArticleAttribute,int>>) });
但在调试methodEntityGet3
叫它一片空白。我做错了什么?
你可以调用它没有反映? –