EntityKeys are case sensitive

If you create an Entity Key on the fly:

dim ekey=New EntityKey("NWentities.Customer","customerID",1234)

then add it to an object

cust.EntityKey=ekey

and then try to Attach the object to a context

cust.EntityKey=ekey

and you get this error message

The member with identity 'NWentities does not exist in the metadata collection.
Parameter name: identity

It's telling you that you have NWentities improperly cased. In my model, it's really NWEntities.

If you get this error message,

The required entry ''customerID' was not found in the provided input. This entry is required by the key fields defined on type 'NWModel.Customer'

then the issue is that the  property name is cased incorrectly.

You can only guess how long it took me to figure that out. Hopefully this will help someone doing a google search in the future.

#1 Phil on 10.15.2008 at 12:06 PM

Most useful, Thanks!

#2 Jason on 9.15.2009 at 11:29 AM

Thanks, saved some hair pulling

#3 Branev on 12.06.2009 at 10:06 AM

Thanks...led me to some ideas :)

Leave a Comment