Print Page | Close Window

Filed to Fetch ... after minor change to EDMX

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1300
Printed Date: 29-Apr-2025 at 4:53pm


Topic: Filed to Fetch ... after minor change to EDMX
Posted By: philcockfield
Subject: Filed to Fetch ... after minor change to EDMX
Date Posted: 03-Jun-2009 at 11:11pm
I have a really simple demo project that I'm using to get rolling with DevForce for Silverlight.

It was working, in so far as it was executing a simple Query against the DB and returning values.  Then I did this:

  1. I updated the EDMX, changing the 'StoreGeneratedPattern' for the ID properties on entities to 'Identity'.
    (NB: I'm using the model-generator in VS-2010 to generate the EDMX and SQL, then copying it back to VS2008)
  2. I updated the DB to reflect the EDMX model (using the expored SQL script)
  3. I copied the updated EDMX into the DevForce test project that was working.
  4. Updated the 'imedmx' file by removing the EntityModel then adding again (not sure if this was over-kill, but seemed like it would do the trick).

Now, I'm now sure if any, or all, of the above is to blame, but I now get the following error when executing the fetch:

Failed to fetch: Error in EdmKey Default: Unable to locate an ObjectContext in the probe assemblies. This is often caused by not copying your EF model 'dll' to the deployment directory. This will be either the client application directory in a two tier deployment or the server deployment directory in an n-tier deployment.

There have been various posts on this form about this particular error, but none recently, and none seemingly related to my situation (I don't think).

So I've screwed something up here...I'd really like to know what it might be, so I can edit models in confidence and not have DevForce stop working on me.

Does anyone have any ideas on what's happening here?  I have copied the sample project to this post if that will help to see what's going on (included in this is the SQL Script to generate the DB).

Thanks!

uploads/518/Sample.zip - Sample Project




Replies:
Posted By: kimj
Date Posted: 04-Jun-2009 at 8:15am
Take a look at TalkAudience.Designer.cs.  It shows that the Entity Model wasn't generated due to an error.

In this case the run time error message means that it really couldn't find the ObjectContext, since it wasn't generated.  (The other primary reason for this message is when the dll is missing altogether.)


Posted By: philcockfield
Date Posted: 04-Jun-2009 at 9:17am
Thanks Kim. I'll look into that.

Regarding your comment: "(The other primary reason for this message is when the dll is missing altogether."

Can you be more specific here please? Precisely what DLL is missing? When I build, in my 'bin' I have a 'TalkAudience.dll' emitted.

What should be there?

Thanks.



Posted By: philcockfield
Date Posted: 04-Jun-2009 at 9:29am
I figured out how to get the EDMX building (so that the 'TalkAudience.Designer.cs' file auto-generates) and now DevForce is working again.

Thanks

It was the inclusion of the StoreGeneratedPattern="Identity" attributes on ID's that was causing it to fail.

Do you have any guidance on how to get IDENTITY working in the EDMX or the DB? I went down this path based on the reference in the 'Notes on Adding and Deleting Sample.pdf' learning-unit document about how DevForce handles automatically handles identity creation. The document explains the behavior, but not how to make it happen [apologies, I'm not a DB guy at all].

Reference Extract:
Pg1:

Approach to Setting Key Value
...
2. Allow DevForce to handle it
Backing database is SQL Server and the primary key of the entity’s backing table is an auto-generated identity.


Posted By: kimj
Date Posted: 04-Jun-2009 at 10:27am
Store generated IDs work in DevForce, and shouldn't cause a problem when the Entity Model is generated from the EDMX either.  Now that you have an updated database (or you did at some point), try updating or regenerating the model from the database in VS2008 to let the designer build the EDMX.  Maybe there are EDMX changes from VS2010 which aren't recognized in VS2008.
 
When using store generated IDs there's nothing special you have to do in your DevForce application.  You don't need your own IIdGenerator, and you don't need to call GenerateId() for new items -- it should just work.
 
Regarding the ObjectContext error - I was referring to the "Entity Model" assembly, the assembly holding the EDMX-generated code.  In an application such as your attached Silverlight example, the web project assembly holds both the "Entity Model" and "Domain Model" so the possibility of a missing assembly doesn't apply.
 


Posted By: philcockfield
Date Posted: 04-Jun-2009 at 11:05am
Cool - thanks Kim.



Print Page | Close Window