Closed Konohomaru closed 2 years ago
Hi @Konohomaru -
No, in micro-ORM style Mighty does not automatically handle table relationships.
You can ofc write a SELECT statement which does the joins you need, and then use Mighty to read from that and hydrate (hmm, I rather dislike that word, in this context!) either a typed object or a dynamic object with flat fields matching your SELECT.
In the main work project in which I use Mighty, I use db access objects which are flat (ids only) and then have some helper code to fetch and 'hydrate' (again!) the required nested objects to be exposed on the API. These are often objects from reasonably short fixed length lists, which can be pre-loaded once.
But again, as a micro-ORM, I am afraid Mighty does not handle this for you. FYI Dapper I believe has code to support one level of joins, which if it happens to match exactly what you need might be helpful.
Mike
Can MightyORM process complex types?
I have following types in my C# project:
Also in database I have following tables:
I removed mapping attributes to save place and also removed other properties and columns to simplify example.
I tried to create
profile_account
, but Mighty throws an exception. Can it create rows like this?I tried this code to create needed row:
Profile already exists in database.