我已實施通用存儲庫。問題是我在主返回類型中的虛擬類型是null。如何將它們包含在異步調用中? 這是我喜歡的類型:實體框架異步調用存儲庫將虛擬實體返回爲空
public class Translation : Entity
{
public string Text { get; private set; }
public Guid TranslationKeyID { get; set; }
[ForeignKey("TranslationKeyID")]
public virtual TranslationKey TranslationKey { get; set; }
}
現在這裏是方法,其中我想這TranslationKey
實體過在我的結果,但我只得到TranslationKeyId
。我服務的 方法:
public async Task<List<TranslationDto>> ListTanslationsAsync()
{
var translations = await _translationRepository.GetAllAsync().
if (translations != null)
{
return translations.ProjectedAs<List<TranslationDto>>();
}
return null;
}
什麼,而不是寫GetAllAsync的()?
我解決了這個問題,進入存儲庫並添加一個自定義的方法,我可以很容易地使用
include
– ahmadalibaloch 2015-03-26 17:49:34