1

I have a project with parts:

  • A silverlight app
  • An asp.net mvc web front that hosts several pages including the one for the silverlight app
  • A common library that has the model generated from an entity framework edmx

I needed to add a new property to a table, so first I added it to the database, and then on the entity framework, right click -> Update Model From Database. The entity framework diagram shows the new field, and the asp.net web front can use the new property in its controller actions no problem, but the generated code that gets dumped in the Silverlight application does not contain the new field, so the Siverlight application acts as if it doesn't exist.

How can I get the generated code to respect the new property?

Stack Overflow posts I have followed:

After updating Entity Framework model, Visual Studio does not see changes

  • I looked on the update website, and it does not show update 1, it shows update 4, which I have installed

Entity Framework 5 update model from database does not generate table class

  • I do not have a .tt file anywhere in my projects

Additionally, I have found that even though intellisense picks up the new property in the asp.net project, when actually trying to execute code for that property I get this error:

Method not found: 'Void Models.User.set_Subscribed(System.Nullable1)'.

Community
  • 1
  • 1
Sean Forman
  • 400
  • 4
  • 16

2 Answers2

1

I found an answer which solved both problems:

The dll generated from the common library was copied to C:\Windows\Microsoft.NET\assembly\GAC_MSIL

When I checked, it was a version several months old. When I deleted it, everything started working as expected, and intellisense started showing the property for Silverlight.

Sean Forman
  • 400
  • 4
  • 16
0

but the generated code that gets dumped in the Silverlight application

Rebuild (do a full Clean first) of the web service project hosting the Silverlight application. That should update any RIA access or WCF data services which actually ultimately use the EF edmx.

If it is using WCF data services then you will need to update the service reference after building the web service project.

Keep a note to possibly shut down the local IIS Express before updating the service reference because a cached service will foil a WCF data services project.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
  • Thanks, I did several cleans and rebuilds of everything, but the dll in the gac was not properly updated, as I discovered later. I would have thought a clean would delete the dll which would have solved my problem – Sean Forman Jul 29 '15 at 04:09