I added two new tables to the database: EmailCampaign and EmailTemplate.
I updated the EDMX with Update Model From Database.
The EDMX is in a RIA Services class library.
Now from the client side (a silverlight library) i cannot see the newly created entities only the old ones.
I checked the EF Designer.cs generated code and the new entities are there, i just cannot access them from the client.
I tried deleting and readding the EDMX but it didn’t work.
UPDATE
I figured out that the entities are exposed trough a Domain Service. I recreated the Domain Service and everything worked. But the problem becomes each time I have new tables in the database how do I regenerate the Domain Service without generating a new Domain Service .cs file and copy pasting my old code into the newly generated and solving all the errors that appear (each time the same). So it’s a burden. Are there some tools out there or some frameworks?
Partial classes are your friend! I broke my domain service class into smaller ones, grouping entities that I often use together – which is parralleled with my client side Model classes. So my main domain service class looks like this…
then each file contains this:
That way, if I change a table, I only have to re-create the domain service for the tables selected.
This means that when I create the “new” table, I just use some bogus name, create the files, and subsequently replace the “public partial class ” line. The buddy files requires no changes at all. Just be careful of your namespaces!
HTH,
Richard