Adding table from another database to ASP.NET Dynamic Data + Entity Framework

Go To


I have a table in another database I would like to scaffold via ASP.NET Dynamic Data and incorporate into my existing Entity Model - is there anyway to do this? (eg using a view or other mechanism or customize the view, edit or insert operations via ad-hoc SQL or stored procedures?)

I don't want to replicate the entire DynamicData sub-folder structure and create another entity model for just one table

2012-04-03 22:00
by blue18hutthutt


I was able to solve this by manually creating an entity in the SSDL and CSDL sections of the .edmx file by using a DefiningQuery and then defining the EntitySets for my entity class

I also added insert / update / delete Function elements to the SSDL with inline SQL using the CommandText property

At this point I had enough to let the Designer map the CRUD methods to these inline SQL functions I defined

It's a little tricky but it works and the general approach opens up many possibilities I had not thought about

2012-04-05 21:16
by blue18hutthutt