Note that there are some explanatory texts on larger screens.

plurals
  1. POORM (Nhibernate, etc.) with legacy entity model
    primarykey
    data
    text
    <p>I'm probably going to answer my own question in asking it but here goes...!</p> <p>I'm investigating whether it is useful migrating parts of our legacy application to an ORM framework to take advantages of a strongly-typed domain model, validation, strongly-typed queries, etc.</p> <p>However, our current design methodology is to build Dtos to flatten multiple complex entities into a single manageable object. This works very well since it gives the object a specific purpose and avoids any confusion when working with it. It is also useful in a web context since it is completely disconnected from the data layer.</p> <p>The issue we are trying to solve is having a write lots of boilerplate code to query and update the database.</p> <p><strong>Moving on to the topic of using an ORM.</strong></p> <p>We don't particularly want to move away from Dtos due to the reasons stated above. I have evaluated both Entity Framework 4.1 (code-first) and NHibernate 3.1 (fluent) and can't get around the issue of how to update a complex Dto back into it's relevant entities.</p> <p>e.g.</p> <p>Let's say that I have a Customer Entity and an Address entity with the following CustomerAddress Dto:</p> <pre><code>class CustomerEntity { public String ID {get;set;} public String Name {get;set;} public String Address1 {get;set;} public String Address2 {get;set;} } </code></pre> <p>I then want to send the updated properties back to the database through the entity models.</p> <p>I have got as far as using AutoMapper to map the CustomerEntity back to the respective Customer/Address entities. However, I am forced to take a query hit on the database to retrieve the customer/address entities before the update is done.</p> <p>Since our legacy database contains some tables with large numbers of columns, it seems an unnecessary performance hit to have to load each entity in full before updating.</p> <p>Is there a way that I can write an command to only update specific properties of the entity or am I trying too hard to work against the ORM paradigm?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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