Open RIA Services User Support Different EDMX types in one project  Viewed 38166 time(s), 5 post(s)., 4/28/2014 6:06:37 AM - by TDenis

ColinBlair
ColinBlair 4/28/2014 4:50:50 PM

There is a good chance it will be fixed. Also, I am working on making the boilerplate CRUD code unneeded by having the DomainService do it at runtime.

BTW, your option 5 is how I have been using RIA Services for years. When DbContext support was first added to WCF RIA Services they released some snippets to help create the DomainService, those are what I have been using ever since.

http://www.riaservicesblog.net/Blog/post/WCF-RIA-Services-EF-41-and-Snippets.aspx

This content has not been rated yet. 
1539 Reputation 130 Total posts
1
TDenis
TDenis 4/28/2014 6:06:37 AM

I have a lot of legacy ObjectContext EDMX files in my project. It`s a relatively large project and there is a lot of code and it would be hard for me to quickly replace legacy contexts with DbContext classes. I`d like to replace legacy models one by one. But when I create a service for the DbContext model using the wizard, there is a message in the window that some context classes excluded and the wizard can`t find any entities in my DbContext class.
It that by design or it`s just a wizard bug? Can I have different context types in one project?

All ObjectContexts are EF6 models with EF6 EntityObject generator attached. I have following packages installed: EntityFramework 6.1.0, OpenRiaServices.Server 4.3.0 and OpenRiaServices.EntityFramework 4.3.0.

Thanks in advance.

This content has not been rated yet. 
86 Reputation 8 Total posts
2
bengutt
bengutt 4/28/2014 8:14:00 AM

Hi,

I had a similar problem when I started to look at Open Ria (at the same time as moving to EF6 and Dbcontext from Object context).

I found that if I had tables in multiple models, I had to rename tables so each model had a unique name for each one. I'm still in the process of moving over and haven't yet tested that this is actually working. I could be barking up the wrong tree here, so I'd try it with one model and see if it appears before going head long into it!

Ben.

This content has not been rated yet. 
80 Reputation 9 Total posts
3
ColinBlair
ColinBlair 4/28/2014 3:01:42 PM

I also have a mix of older EDMX ObjectContext models and newer code first DbContext models but I have decided to just leave everything as-is other than upgrading it to EF6. What I don't do is mix DbContext and ObjectContext in the same project, but I don't know if that makes any difference.

The warning message about missing contexts just shows if DbContext is detected and is left over from Microsoft's code. It doesn't mean there is a problem, just that the wizard sees that there is a DbContext in your code.

This content has not been rated yet. 
1539 Reputation 130 Total posts
4
TDenis
TDenis 4/28/2014 4:33:24 PM

So, I have a lot of legacy ObjectContexts in my project and if I create a new DbContext model and import few tables, the wizard can see the new model itself, but it can`t find any entities in it. It can find entities only if I create an ObjectContext, not a DbContext.
Looks like my options are:
1. Stay with ObjectContext forever.
2. Replace all ObjectContexts with DbContexts at once (not easy to do)
3. Rename ObjectContext/DbContext entities to get rid of naming conflicts (not convenient & need to test)
4. Create another project for storing DbContext-based services. Then may be another one to hold some common classes, that are used by the ObjectContext and the DbContext projects (bugs driven design).
5. Not to use a wizard (need to type a lot).

I just wanted to know if there are chances that the issue will be fixed. If yes (or probably yes) then I`ll prefer to stay with ObjectContexts and wait. If no then I'll pick another option, create a new project for example.

Thanks!

This content has not been rated yet. 
86 Reputation 8 Total posts
5