本文整理汇总了C#中IDocumentSession.Include方法的典型用法代码示例。如果您正苦于以下问题:C# IDocumentSession.Include方法的具体用法?C# IDocumentSession.Include怎么用?C# IDocumentSession.Include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDocumentSession
的用法示例。
在下文中一共展示了IDocumentSession.Include方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFacebookUser
public User GetFacebookUser(string facebookId, IDocumentSession session)
{
if (session == null) throw new ArgumentNullException("session");
var id = FacebookId.MakeKey(facebookId);
var facebookUser = session
.Include<FacebookId>(f => f.UserId)
.Load(id);
if (facebookUser == null)
return null;
return session.Load<User>(facebookUser.UserId);
}
示例2: GetUserFromApiKey
public static IUserIdentity GetUserFromApiKey(IDocumentSession ravenSession, string apiKey)
{
if (apiKey == null)
return null;
var activeKey = ravenSession.Include<ApiKeyToken>(x => x.UserId).Load(GetApiKeyDocumentId(apiKey));
if (activeKey == null)
return null;
if (DateTimeOffset.UtcNow.Subtract(TimeSpan.FromDays(7)) > activeKey.LastActivity)
{
ravenSession.Delete(activeKey);
ravenSession.SaveChanges();
return null;
}
activeKey.LastActivity = DateTimeOffset.Now;
ravenSession.SaveChanges();
return ravenSession.Load<User>(activeKey.UserId);
}
示例3: Get
public static BackFill Get(string id, IDocumentSession session)
{
var backfill = session.Include<BackFill>(x => x.MainContactId).Load(id);
backfill.MainContact = session.Load<Contact>(backfill.MainContactId);
return backfill;
}
示例4: Get
public static Booking Get(string id, IDocumentSession session)
{
var booking = session.Include<Booking>(x => x.MainContactId).Load(id);
booking.MainContact = session.Load<Contact>(booking.MainContactId);
return booking;
}
示例5: ProcessBatches
bool ProcessBatches(IDocumentSession session)
{
var nowForwarding = session.Include<RetryBatchNowForwarding, RetryBatch>(r => r.RetryBatchId)
.Load<RetryBatchNowForwarding>(RetryBatchNowForwarding.Id);
if (nowForwarding != null)
{
var forwardingBatch = session.Load<RetryBatch>(nowForwarding.RetryBatchId);
if (forwardingBatch != null)
{
Forward(forwardingBatch, session);
}
session.Delete(nowForwarding);
return true;
}
isRecoveringFromPrematureShutdown = false;
var stagingBatch = session.Query<RetryBatch>()
.Customize(q => q.Include<RetryBatch, FailedMessageRetry>(b => b.FailureRetries))
.FirstOrDefault(b => b.Status == RetryBatchStatus.Staging);
if (stagingBatch != null)
{
if (Stage(stagingBatch, session))
{
session.Store(new RetryBatchNowForwarding { RetryBatchId = stagingBatch.Id }, RetryBatchNowForwarding.Id);
}
return true;
}
return false;
}