I do not understand how to create through PetaPoco tables corresponding to the created database model.
1 answer
You are using PetaPOCO - this is one of MicroORM. MicroORM is a very thin layer between SQL and primitive C # classes (POCO). What you write is more suitable for a large ORM like Entity Framemework (and only with the Code First approach).
Therefore, the best ways to do this are:
- Manually add tables using SQL.
- Write code that will generate SQL, which will do what you wrote. For example, you can add it at the start of the application and check the availability of the tables, then, if necessary, create them. This will help you reflection (to extract the necessary classes C #) and sampling the database metadata (to understand what the table is).
- I am interested in whether there is an elegant way to do this, instead of going along these paths :) And Entiti is too slow and weighty ... But in general I understood ... - Andrew
- @Andrew write code that goes through the database and assembly metadata is a very elegant way. A heavyweight ORM will do the same. - Vadim Ovchinnikov
- I understand that, I was just sure that such a task through PetaPOCO can also be solved = (It was, as it were expected ... Or some kind of addition to it. Or we can hang the ready code from someone :) - Andrew
|