0
我無法使用此代碼,因爲成員在UI中不可用。自定義類中的Lambda表達式
public MemberViewModel GetSingle(Expression<Func<Member ,bool>> whereCondition)
{
var member = this.MemberRepository.GetSingle(whereCondition);
if (member != null)
{
return new MemberViewModel(member);
// or however you map from member to its view model
}
return null;
}
什麼是自定義類看起來像替換表達式?它會像這樣流...
public MemberViewModel GetSingle(CustomClass where)
{
// Create customExp of type Expression<Func<DAL.EntityModels.Category,
// bool>> out of CustomObject
// _categoryRepository.GetSingle(customExp);
// Convert the resulting dataobject to corresponding view object
// return the view object
}
任何幫助表示讚賞。
哪種語言? Java的? C#? Scala呢? –
@Anonymouse:表達式是C#:) – leppie
具體的.Net 4.0 –