当前位置: 首页>>代码示例>>C#>>正文


C# IDocumentSession.Include方法代码示例

本文整理汇总了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);
        }
开发者ID:rdingwall,项目名称:100books,代码行数:15,代码来源:UserRepository.cs

示例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);
        }
开发者ID:synhershko,项目名称:NSemble,代码行数:20,代码来源:NSembleUserAuthentication.cs

示例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;
 }
开发者ID:RHMGLtd,项目名称:sourcecode,代码行数:6,代码来源:Backfill.cs

示例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;
 }
开发者ID:RHMGLtd,项目名称:sourcecode,代码行数:6,代码来源:Booking.cs

示例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;
        }
开发者ID:SaintLoong,项目名称:ServiceControl,代码行数:35,代码来源:RetryProcessor.cs


注:本文中的IDocumentSession.Include方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。