本文整理汇总了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);
}
示例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";
};
}
示例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();
}
示例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();
}
示例5: SecondQuery
static Task<int> SecondQuery(IAsyncDocumentSession session)
{
return session.Query<Logfile>().Where(x => x.StoreId != SampleLogfileStoreId && x.SavedAnalyses.Any()).CountAsync();
}
示例6: ThirdQuery
static Task<int> ThirdQuery(IAsyncDocumentSession session)
{
return session.Query<Logfile>().Where(x => x.StoreId != SampleLogfileStoreId && x.SharedOnFacebookActionId != null).CountAsync();
}
示例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();
}
示例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();
}