-3

I'm working on a project for this summer which involves a database of customers. Each customer has fields like FirstName, LastName, CreatedDate, etc. These Customer objects are stored in a SQL DB. I'm building a UI (in Blazor & C#) which exposes the data to users and allows users to edit the data. Upon submission of an edit, a new Customer object is created to store the changes, and is linked to the original (unchanged) object through a special ID field. I would then like to somehow convert the changes made to the model to an 'Update' SQL statement, which will eventually be reviewed, approved and executed on the DB.

I'd like to do this conversion using something more lightweight, like a library. I have done some research and found a few frameworks which may be useful, but I thought that someone in the community may have knowledge of a library which may be implemented more quickly. Thanks for any help y'all can give!

Asmith
  • 1

1 Answers1

3

Have you considered Entity Framework? It's the Microsoft-built library that basically does what you're describing to the letter.

If you are managing schemas, migrations allow you to drive the database schema from code, and reverse engineering allow you to generate code from the database schema.

If you'd like to review generated SQL statements, you can log and review ToTraceString() in your code.

Bas
  • 26,772
  • 8
  • 53
  • 86