Skip to content

Developers Guides

Eduardo Fonseca edited this page Jul 19, 2024 · 4 revisions

Pre-Requisites

Before starting make sure to install the "EF Core Power Tools".

https://marketplace.visualstudio.com/items?itemName=ErikEJ.EFCorePowerTools

How to Add a New Table

  • Go to the "FairPlayCombinedDb" project.
  • Create a new table under the correct schema folder hierarchy. Use "dbo" for tables used by multiple applications.
  • Make sure the script has the correct scheme.
  • Make sure the table as a primary key column in the format "TableName{Id}
  • Make sure the table has a primary key constraint with the name format "PK_{TableName}".
  • Make sure to create unique indexes when required.
  • Make sure to create the Foreign Keys when required

After the you have created the table go to the project "FairPlayCombined.DataAccess"

  • Right click on the project "FairPlayCombined.DataAccess"
  • Select "EF Core Power Tools"
  • Select "Reverse Engineer"
  • Follow the wizard to add the new table. Leave the options as they are, only include the new table.

Note: EF Core Power Tools are not yet ready for .NET 9. If the "Reverse Engineer" option does not show up, temporarily change the DataAccess project to use .NET 8 instead of .NET 9. Change back to .NET 9 after the data access classes are generated.

Note: If your table has the auditing columns, you need to manually create a new partial class, in the same folder of your table's generated entity class. The partial class must implement IOriginatorInfo. Make sure the partial class is in the same namespace as your entity.  

How to Create a New Page

Clone this wiki locally