Search code examples
c#oracle-databaseentity-frameworkef-code-first

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 ?


Solution

  • 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.