Raed Alsaleh
Raed Alsaleh

Reputation: 1621

DateTime Always Changed To TimeStamp In Entity Framework Code First

When trying to add new entity that contains date-Time attributes Like :

public DateTime CREATION_DATE { get; set; }

then exec add-migration command the migration file change the type from date/datetime to TimeStamp
Why This happen and how can I solve this issue ?

Upvotes: 0

Views: 434

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89006

Every database provider has a default mapping of .NET types to database types. You can override this by decorating the entity property with a ColumnAttribute, or using the HasColumnType fluent property configuration.

Upvotes: 1

Related Questions