Note that there are some explanatory texts on larger screens.

plurals
  1. POAdvice required - using entity framework with normalised data
    primarykey
    data
    text
    <p>I've recent gone through the process of revamping my database, normaising a lot of entities. Obviously I now have a few more tables than I had. A lot of data I use on the website is readonly so this is simple to denormalise using a view, however there are entities that could benefit from denormalised retrieval but still need to be updated.</p> <p>Here's an example.</p> <pre><code>A User may be a Member A Member may have a Profile A Member may have an Account </code></pre> <p>In addition I have 3 further lookup tables.</p> <p>In total there are 3 tables for User and 4 tables for Member.</p> <p>Ideally, I can create 2 views from the above tables.</p> <p>However, User needs to be updated as do the entities belonging to Member. Additionally there are 6 separate tables associated with Users/Members, i.e. FavouriteCategories that also need to be retreived and updated from time to time.</p> <p>I'm struggling to come up with the best, most efficient way of doing this.</p> <p>I could simply not use views and bring all the entities and lookups into the model, but I would be reliant on EF to produce the retreival queries. The stuff I've read suggest that EF is not best at dealing with joined data.</p> <p>I could add both the view and tables, using the tables for updates only. This seems sloppy due to the duplication, complication of the model, as well as underutilising the EF model functionality.</p> <p>Maybe I could use the readonly view for data retrieval and create stored procs. I believe that the process of using EF with stored procs is a bit of a hack, so I'd probably keep the stored procs distinct from EF and simply pass params and call the SP via traditional methods. This again seems like a bit of a halfway house.</p> <p>I'm not that experienced with .net or EF, so would appreciate some solid advice on either the methods I've referred to above or any better technique to acheive this. I don't want to go hacking the edmx file at this stage because... well it's just wrong.</p> <p>I have a few entities that would benefit from the right solution. The User example is amongst the simplest, so there's a lot to gain from the right approach. </p> <p>Help and advice would be very much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload