2

I'm following this "guide" on how to expose Date (not DateTime) in your ODataController

However I don't quite get how I should implement the .AsDate() extension method

public static class PrimitivePropertyConfigurationExtensions 
{ 
  public static PrimitivePropertyConfiguration AsDate(this PrimitivePropertyConfiguration property)
  {…}

  public static PrimitivePropertyConfiguration AsTimeOfDay(this PrimitivePropertyConfiguration property)
  {…}
} 

What goes in the ... place? Am I missing something obvious?

None of the methods on property seem to make sense.

Snæbjørn
  • 10,322
  • 14
  • 65
  • 124

1 Answers1

1

As per Date & time mapping with EF

2 Fluent API

public static class PrimitivePropertyConfigurationExtensions 
{ 
  public static PrimitivePropertyConfiguration AsDate(this PrimitivePropertyConfiguration property)
  {
    property.HasColumnType("date");
  }

  public static PrimitivePropertyConfiguration AsTimeOfDay(this PrimitivePropertyConfiguration property)
  {
    property.HasColumnType("time");
  }
} 
Aron
  • 15,464
  • 3
  • 31
  • 64