I am learning ASP.NET Core MVC and my model is
namespace Joukyuu.Models
{
public class Passage
{
public int PassageId { get; set; }
publi
Its too easy.Just you should do 2 step:
1.create model with these fields on top of createDate
field:
[Required, DatabaseGenerated(DatabaseGeneratedOption.Computed)]
2.After create migration and in its file befor update database edit column of this part and add defaultValueSql: "getdate()"
like this:
id = table.Column(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreatedDate = table.Column(defaultValueSql: "getdate()",nullable: false)