ZVenue,您可能只想查詢您的RDate屬性的Date組件。如果是這種情況,只需正確地擴展您的查詢。
但是,我不確定你是否掌握了基本知識,因此我已經組建了一個小型示例應用程序。實際上很無聊,但我希望它有幫助:
class Movie
{
public string Id { get; set; }
public string Name { get; set; }
public DateTime Date { get; set; }
}
class Program
{
static void Main(string[] args)
{
using (var documentStore = new DocumentStore { Url = "http://localhost:8080/" })
{
documentStore.Initialize();
//SeedData(documentStore);
using (var documentSession = documentStore.OpenSession())
{
var movies = documentSession.Query<Movie>()
.Where(x => x.Date.Date == new DateTime(2011, 6, 2))
.ToList();
foreach (var movie in movies)
{
Console.WriteLine(string.Format("Name: {0}", movie.Name));
}
}
}
Console.Read();
}
private static void SeedData(IDocumentStore documentStore)
{
var movies = new Movie[]
{
new Movie {Name = "May", Date = new DateTime(2011, 5, 1)},
new Movie {Name = "June", Date = new DateTime(2011, 6, 1)},
new Movie {Name = "June2a", Date = new DateTime(2011, 6, 2)},
new Movie {Name = "June2b", Date = new DateTime(2011, 6, 2)},
new Movie {Name = "June2c", Date = new DateTime(2011, 6, 2, 5, 0, 0)},
new Movie {Name = "June2d", Date = new DateTime(2011, 6, 2, 6, 0, 0)},
new Movie {Name = "June3", Date = new DateTime(2011, 6, 3)},
new Movie {Name = "July", Date = new DateTime(2011, 7, 1)},
};
using (var documentSession = documentStore.OpenSession())
{
foreach (var movie in movies)
{
documentSession.Store(movie);
}
documentSession.SaveChanges();
}
}
}