I am using Entity Framework in a Web API project. I have created my classes and models from an existing Database (MySQL), so I basically used the EF DbContextGenerator to generate my classes from my EDMX model.
Read operations are working fine, but I am now at the point where I want to start adding functionality to add records to the database. I want the id for entities to be automatically assigned by the database.
It seems like when you are following a code-first approach, one simply needs to specify:
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
In the class definition for the Id property. So I am tempted to simply add the "DatabaseGeneratedOption" to the class file that was generated. However, since I am using a database-first approach and my classes are basically auto-generated for me, I am not supposed to edit the class files as they will get overwritten again should I re-generate the classes again. Where/How do I set the Id value to be generated by the database rather than by the EF code?
It's an option in the properties of a property (o_O) in the edmx designer:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With