Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Feature: One model used for wide entities and narrow entity representations [264]

$
0
0
Scenario:
1. Customer has backend SQL Server with wider rows.
2. Customer syncs with SDF files (SQL CE). Slimmer rows in SDF file.
3. Would like to use the same model for both. The premise is that EF would look at the DB for those non-manditory columns (whatever way they are represented) and build meta data accordingly.
Comments: Discussed with James, here is the scenario: * Application server running in IIS that serves a site, ie. Web clients. The model used for that enables the application to serve all nullable columns/properties within the table. * The application also includes an offline mode where fat clients are able to utilize Microsoft Sync Framework to synchronize the larger DB set with a local copy in SQLCE. This SQLCE version has the same tables (entities) but the width (number of columns) is far less. This requires a similar but different model to the one in point #1 above. * The customer finds the creation and maintenance of two separate models to be a chore. They could like to utilize the same model for both web and fat offline clients. In this case EF would ‘know’ the different aspects of the backend SQL and only map what is appropriate. While the original ask was for EF to automatically detect missing columns and exclude them from the model we concluded that this wasn't really a piece of functionality that would be useful to other customers. However, the higher level scenario can already be supported very easily with Code First by having some conditional logic in OnModelCreating that calls Ignore on the ‘wide’ properties if it’s going to access the local database. In EF6 you could also create an attribute to put on the properties and then have a convention that excludes them in local mode if the attribute it present.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>