entity framework 4 - How to add a table to the EF4 Context dynamically in code - No Code First -


we run series of reports every 6 months , store results tables can queried/viewed @ time in future. depending on cycle either 2 or 4 tables added. have standard naming convention of yyyy_mmm_table_x.

our website built using asp.net mvc2 , database modeled using ef4 using standard model designer, not code first.

i able dynamically add report tables ef4 context @ runtime. don't want have manually add them model using designer, otherwise every reporting cycle have update , recompile model because added reports. maintenance headache when nothing else has changed.

i can list of available tables querying sysobjects. if list , add tables context when site started use dynamic linq library query against them depending on table user selected dropdown.

i can't use ef4's code first out of box because force me create concrete classes tables , same maintenance headache. suspect use same strategies code first framework uses dynamically update context, haven't looked @ library @ , i'm hoping familiar can point me in right direction.

otherwise think have drop ado.net handle area. may best , simple way guess i'm looking comments. i'm not zealot don't need in linq , ef4. :) seem little cleaner , consistent, if allows me make use of dynamic linq. old way simpler.

so, if have suggestions or comments love hear them.

thanks!

even common ef still need new data type each table because when map table need new objectset of new entity type able run queries. know not possible map 2 tables same entity if table structure absolutely same.

all runtime mapping stored in metadataworkspace prepared entityconnection. if want play can start there public interfaces of these classes don't promising.

i guess want run linq-to-entities on these tables using stored procedure returning data correct table based on data parameter not option.

you should use common ado.net this.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -