0
我想找到一種方法,使用一個控制器構造函數中的自定義用戶提供以沒有獲得用戶的每一個方法(髒)..在控制器CTOR .NET MVC用戶詳細信息
這是什麼是我的ctor但一直返回null?
Resource oResource;
public EntityController()
{
try
{
DataEntities oEntities = new DataEntities();
oResource = oEntities.Resources.Where(c => c.user == User.Identity.Name).First();
}
catch
{
oResource = new Resource();
}
}