Any way to do this? For example, I want my DateTime field to be indexed in descending order.

asked Jan 13 '11 at 22:07

ara's gravatar image

ara
395878791


One Answer:

Hello Ara,

Here is an example of almost all index construction-related options from the online manual. Notice [Index("HireDate:DESC"... part.

[Index("FirstName",  "LastName")]
[Index("Login", Unique = true, Name = "IX_LOGIN")]
[Index("HireDate:DESC", IncludedFields = new[]{"FirstName", "LastName"})]
public class Employee : Person
{
  [Field, Key]
  public int Id { get; private set; }

  [Field]
  public string Login { get; set; }

  [Field(Length = 20)]
  public string LastName { get; set; }

  [Field(Length = 10)]
  public string FirstName { get; set; }

  [Field]
  public DateTime HireDate { get; set; }

Hope that helps.

answered Jan 13 '11 at 22:17

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA