{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4861","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4861/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4861/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4861/events","html_url":"https://github.com/aspnet/EntityFramework/issues/4861","id":142083596,"number":4861,"title":"The order of calls for ValueGeneratedOnAddOrUpdate, HasDefaultValueSql","user":{"login":"chandrush","id":1695006,"avatar_url":"https://avatars.githubusercontent.com/u/1695006?v=3","gravatar_id":"","url":"https://api.github.com/users/chandrush","html_url":"https://github.com/chandrush","followers_url":"https://api.github.com/users/chandrush/followers","following_url":"https://api.github.com/users/chandrush/following{/other_user}","gists_url":"https://api.github.com/users/chandrush/gists{/gist_id}","starred_url":"https://api.github.com/users/chandrush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chandrush/subscriptions","organizations_url":"https://api.github.com/users/chandrush/orgs","repos_url":"https://api.github.com/users/chandrush/repos","events_url":"https://api.github.com/users/chandrush/events{/privacy}","received_events_url":"https://api.github.com/users/chandrush/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-19T17:24:23Z","updated_at":"2016-03-20T07:25:26Z","closed_at":null,"body":"Depending on the order of calls a get different results for generated migrations.\r\n\r\nExample. RecordVersion is the property with DateTime type.\r\nThis setup\r\n`ie.Property(e => e.RecordVersion)\r\n\t.HasDefaultValueSql(\"GetDate()\")\r\n\t.ValueGeneratedOnAddOrUpdate();`\r\nresults in this column definition:\r\n`[RecordVersion] AS GetDate()`\r\n\r\nThis setup\r\n`ie.Property(e => e.RecordVersion)\r\n\t.ValueGeneratedOnAddOrUpdate()\r\n\t.HasDefaultValueSql(\"GetDate()\");`\r\nresults in this column definition\r\n`[RecordVersion] datetime2 NOT NULL DEFAULT (GetDate())`\r\n\r\nDoes it the right behaviour?\r\nI prefer the second one. Update on the column I'm going to make with the trigger. Also, the second case allows me to put an index on the column, and the first one doesn't.\r\n\r\n\r\nUsed libraries are:\r\n\"EntityFramework.Core\": \"7.0.0-rc1-final\",\r\n\"EntityFramework.MicrosoftSqlServer\": \"7.0.0-rc1-final\",\r\n\"EntityFramework.Commands\": \"7.0.0-rc1-final\"."},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/198863439","html_url":"https://github.com/aspnet/EntityFramework/issues/4861#issuecomment-198863439","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4861","id":198863439,"user":{"login":"smitpatel","id":1528107,"avatar_url":"https://avatars.githubusercontent.com/u/1528107?v=3","gravatar_id":"","url":"https://api.github.com/users/smitpatel","html_url":"https://github.com/smitpatel","followers_url":"https://api.github.com/users/smitpatel/followers","following_url":"https://api.github.com/users/smitpatel/following{/other_user}","gists_url":"https://api.github.com/users/smitpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/smitpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smitpatel/subscriptions","organizations_url":"https://api.github.com/users/smitpatel/orgs","repos_url":"https://api.github.com/users/smitpatel/repos","events_url":"https://api.github.com/users/smitpatel/events{/privacy}","received_events_url":"https://api.github.com/users/smitpatel/received_events","type":"User","site_admin":false},"created_at":"2016-03-20T07:25:26Z","updated_at":"2016-03-20T07:25:26Z","body":"dupe of #4328 Already fixed in latest and will be shipped in RC2 release"}}