Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating database tables from object definitions

I know that there are a few (automatic) ways to create a data access layer to manipulate an existing database (LINQ to SQL, Hibernate, etc...). But I'm getting kind of tired (and I believe that there should be a better way of doing things) of stuff like:

  1. Creating/altering tables in Visio
  2. Using Visio's "Update Database" to create/alter the database
  3. Importing the tables into a "LINQ to SQL classes" object
  4. Changing the code accordingly
  5. Compiling

What about a way to generate the database schema from the objects/entities definition? I can't seem to find good references for tools like this (and I would expect some kind of built-in support in at least some frameworks).

It would be perfect if I could just:

  1. Change the object definition
  2. Change the code that manipulates the object
  3. Compile (the database changes are done auto-magically)
like image 739
Farinha Avatar asked Jan 25 '23 04:01

Farinha


1 Answers

Check out DataObjects.Net - is is designed to support exactly this case. Code only, and nothing else. Its schema upgrade layer is probably the most featured one you can find, and it really fully abstracts schema upgrade SQL.

Check out product video - you'll notice nothing additional is made to sync the schema. Schema upgrade sample shows the intended usage of this feature.

like image 61
Alex Yakunin Avatar answered Jan 29 '23 07:01

Alex Yakunin