我在查询此文档时遇到了最新的 MongoDB C# 驱动程序 (v1.4.2.4500) 崩溃的问题:
{
"_id" : "4fdfe705b48c6b24dcab994a",
"CreatedDate" : new Date("6/18/2012 19:42:13"),
"UpdatedDate" : new Date("6/18/2012 19:42:13"),
"SiteId" : "4fdfe705b48c6b24dcab9939",
"ClientId" : "4fdfe705b48c6b24dcab9937",
"Account" : {
"UserName" : "blah",
"Password" : null,
"PasswordSalt" : null,
},
"FbAccount" : {
"_id" : "838331911",
"access_token" : "…..",
"Pages" : []
}
}
询问:
var q1 = from u in this.Repository.All<User>()
where u.FbAccount.Id == "832631911"
select u;
var foo1 = q1.First();
存储库:
public IQueryable<T> All<T>() where T : class, new()
{
return this.GetQuery<T>().FindAll().AsQueryable();
}
例外:
[NullReferenceException: Object reference not set to an instance of an object.] lambda_method(Closure , User ) +137 System.Linq.WhereEnumerableIterator`1.MoveNext() +155 System.Linq.Enumerable.First(IEnumerable`1 source) +244 lambda_method(Closure ) +322 System.Linq.Queryable.First(IQueryable`1 source) +382 Framework.Services.ClientService.GetByFacebookUserId(String
fbUserId) 在 ClientService.cs:39
我做错了什么还是这是一个错误?