c# - Flattening multiple tables to a single type -


i'm trying model database using entityframework's fluent configuration. cannot edit or otherwise control database schema. entity trying model has lot of look-up tables - example, 1 property (it's name) has whole table devoted name associated id (which it's language). in other words, looks bit in database:

entity     string[] names  entity_names     string name     int languageid // 9 = english 

however, trying condense into

entity    string name // want english name 

using sql query, pretty simple - how can via entity framework's fluent configurations? there lot more of these instances well, simplest example come with.

if manage flatten model way, it's going read-only view of data. there's no way entity framework know string property should looked in table , replaced integer id.

so leaves 2 options if you're okay being view-only. write database view replaces ids strings , build entity view.

or build entities compatible schema model , project data dto.

the second approach 1 i'd prefer means you'd still have compatible entity model if need crud.


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -