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


C# IAsyncDocumentSession.Query方法代码示例

本文整理汇总了C#中IAsyncDocumentSession.Query方法的典型用法代码示例。如果您正苦于以下问题:C# IAsyncDocumentSession.Query方法的具体用法?C# IAsyncDocumentSession.Query怎么用?C# IAsyncDocumentSession.Query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAsyncDocumentSession的用法示例。


在下文中一共展示了IAsyncDocumentSession.Query方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsyncQuery

        public IQueryable<Record> AsyncQuery(IAsyncDocumentSession adb, RecordQueryInputModel input)
        {
            var query = adb.Query<RecordIndex.Result, RecordIndex>()
                .Statistics(out stats);

            return RecordQueryImpl(input, query);
        }
开发者ID:jncc,项目名称:topcat,代码行数:7,代码来源:RecordQueryer.cs

示例2: DiscoveryModule

		public DiscoveryModule(IAsyncDocumentSession session)
			: base("/api/discovery")
		{
			this.session = session;

			Get["/start"] = parameters =>
			{
				var discoveryClient = new ClusterDiscoveryClient(SenderId, "http://localhost:9020/api/discovery/notify");
				discoveryClient.PublishMyPresenceAsync();
				return "started";
			};

			Post["/notify", true] = async (parameters, ct) =>
			{
				var input = this.Bind<ServerRecord>("Id");

				var server = await session.Query<ServerRecord>().Where(s => s.Url == input.Url).FirstOrDefaultAsync() ?? new ServerRecord();
				this.BindTo(server, "Id");
				await session.StoreAsync(server);

				await HealthMonitorTask.FetchServerDatabases(server, session.Advanced.DocumentStore);

				return "notified";
			};
		}
开发者ID:925coder,项目名称:ravendb,代码行数:25,代码来源:DiscoveryModule.cs

示例3: FirstQuery

        static Task<IList<string>> FirstQuery(IAsyncDocumentSession session)
        {
            var now = DateTime.UtcNow;

            RavenQueryStatistics stats;
            return session.Query<Logfile>()
                .Statistics(out stats)
                .Where(x => x.UploadDate >= now.AddMonths(-1))
                .Select(x => x.Owner)
                .Distinct()
                .Take(1024) // see 
                .ToListAsync();
        }
开发者ID:jrusbatch,项目名称:ravendb,代码行数:13,代码来源:IndexMerging.cs

示例4: Index

        public async Task<ActionResult> Index(IAsyncDocumentSession asyncSession)
        {
            // Remove when MVC 4 is released (http://forums.asp.net/p/1778103/4880898.aspx/1?Re+Using+an+Async+Action+to+Run+Synchronous+Code)
            await Task.Yield();

            var mike = (await asyncSession.Query<User>().Take(1).ToListAsync()).FirstOrDefault();
            if (mike == null)
            {
                mike = new User {FirstName = "Mike", LastName = "Noonan"};
                asyncSession.Store(mike);
                await asyncSession.SaveChangesAsync();
            }
            if (mike.F1AccessToken == null || mike.PCOAccessToken == null)
            {
                return RedirectToAction("Authenticate", "F1Auth");
            }

            return View();
        }
开发者ID:highwaychurch,项目名称:web,代码行数:19,代码来源:HomeController.cs

示例5: SecondQuery

 static Task<int> SecondQuery(IAsyncDocumentSession session)
 {
     return session.Query<Logfile>().Where(x => x.StoreId != SampleLogfileStoreId && x.SavedAnalyses.Any()).CountAsync();
 }
开发者ID:jrusbatch,项目名称:ravendb,代码行数:4,代码来源:IndexMerging.cs

示例6: ThirdQuery

 static Task<int> ThirdQuery(IAsyncDocumentSession session)
 {
     return session.Query<Logfile>().Where(x => x.StoreId != SampleLogfileStoreId && x.SharedOnFacebookActionId != null).CountAsync();
 }
开发者ID:jrusbatch,项目名称:ravendb,代码行数:4,代码来源:IndexMerging.cs

示例7: GetKnocksByLocation

        private async Task<IEnumerable<Knock>> GetKnocksByLocation(IAsyncDocumentSession session, Location location, double radius)
        {
            if (session == null)
                throw new ArgumentNullException(nameof(session));

            if (location == null)
                throw new ArgumentNullException(nameof(location));

            return await session.Query<Knock, Knock_ByLocation>()
                                .Spatial(x => x.Location, spatial => spatial.WithinRadius(radius, location.Latitude, location.Longitude))
                                .ToListAsync();
        }
开发者ID:mkonkolowicz,项目名称:KnockKnock,代码行数:12,代码来源:DataRepository.cs

示例8: GetKnocksByFeedId

        private async Task<IEnumerable<Knock>> GetKnocksByFeedId(IAsyncDocumentSession session, string feedId)
        {
            if (session == null)
                throw new ArgumentNullException(nameof(session));

            if (String.IsNullOrWhiteSpace(feedId))
                throw new ArgumentNullException(nameof(feedId));

            return await session.Query<Knock, Knock_ByFeed>().Where(knock => knock.FeedId==feedId).ToListAsync();
        }
开发者ID:mkonkolowicz,项目名称:KnockKnock,代码行数:10,代码来源:DataRepository.cs


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