How to use Default column value from DataBase in Entity Framework?

Implementing the OnCreated event for the entity is the solution I have found. I had a Guid property that I wanted to be populated. By default it was being populated with all zeros (00000-0000-00000-etc). By adding the following to my partial class of the entity I was able to deal with the issue.

partial void OnCreated()
{
    Guid = Guid.NewGuid();
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)