Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In certain scenario, you might want to extend the pre-defined data model by adding a column or entity in the database. There are 2 ways to do that.

To add a new property on an existing model

  1. EF Code first

    Go to project BeYourMarket.Model, find the entity that you would like to add a property. e.g. Category.cs. Then add the property to the model and update the corresponding mapping class CategoryMap.cs in the Mapping folder. Finally, update the database with migrations.

    For more info on EF code first, please visit Code First to a New Database.

  2. Database first

    It's a easier way but require Entity Framework Power Tools in Visual Studio. Go to the database. Add the property to the table. In the visual studio, right click on the project BeYourMarket.Model, choose Entity Framework->Reverse Engineer Code First. It would then update the model accordingly.

    Image Added