I am using Entity Framework 6 to connect to the database. And I used one DateTime Entity but it gives error at the time of database initialization:
1)
Validation Failed For one or more entities ,See "EntityValidationErrors" for more Detail
2)
An Exception occured while initializing database.
IList<tblSystemSettings> defaulttblSystemSettings = newList<tblSystemSettings>();
defaulttblSystemSettings.Add(new tblSystemSettings()
{
LastModify = DateTime.Now
});
foreach (tblSystemSettings systemsettings in defaulttblSystemSettings)
{
context.tblSystemSettings.Add(systemsettings);
}
context.SaveChanges();
public class tblSystemSettings
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public int SystemSettingsId { get; set; }
[DataType(DataType.Date)]//daivshala
public DateTime LastModify { get; set; }
}