KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a POCO that I am trying to create via Code First Migrations and then seed data. The problem is that I want to insert specific values into the identity column when seeding. Here is my POCO public class Result { public long ResultId { get; set; } public long? TeamId { get; set; } public Team Team { get; set; } } And here is my AddOrUpdate call in the Seed method of the Configuration.cs context.Results.AddOrUpdate ( r => r.ResultId, new Result { ResultId = 101, TeamId = null }, new Result { ResultId = 201, TeamId = null } ); As expected, it does not insert the values of 101 and 201, but instead 1 and 2. Are there any DataAttributes I can apply to the model to help with this?
Tags (comma-separated)
Save Edits
Cancel