本文整理汇总了C#中MongoRepository.All方法的典型用法代码示例。如果您正苦于以下问题:C# MongoRepository.All方法的具体用法?C# MongoRepository.All怎么用?C# MongoRepository.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoRepository
的用法示例。
在下文中一共展示了MongoRepository.All方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllActiveRooms
public static List<Room> GetAllActiveRooms()
{
var mongoRepository = new MongoRepository<Room>(ConnectionString);
var oldestDate = DateTime.Now.Subtract(Constants.ActiveRoomTimeSpan);
var x = mongoRepository.All();
var y = x.Where(r => r.DateLastPost >= oldestDate).ToList();
return mongoRepository.All().Where(r => r.DateLastPost >= oldestDate).ToList();
}
示例2: TestFilter
public void TestFilter()
{
var cardRepo = new MongoRepository<Card>();
var queryable = cardRepo.All();
var dateTime = DateTime.UtcNow.Date.AddDays(4);
var f1 = queryable.ToList().Where(card => card.NextDate < dateTime).ToList();
var f2 = queryable.Where(card => card.NextDate < dateTime).ToList();
Console.WriteLine("f1 count = {0}", f1.Count);
Console.WriteLine("f2 count = {0}", f2.Count);
}
示例3: AddSprint
public void AddSprint()
{
var repo = new MongoRepository<Concert>();
var newSprint = new Concert
{
Artist = new Artist
{
Name = "Eddie Meduza"
}
};
repo.Add(newSprint);
var sprint = repo.All(c => c.Artist.Name == "Eddie Meduza");
Assert.That(sprint, Is.EqualTo(newSprint));
}
示例4: GetAllRooms
public static List<Room> GetAllRooms()
{
var mongoRepository = new MongoRepository<Room>(ConnectionString);
return mongoRepository.All().ToList();
}