PB trying to make it wotk with VS2008 SP1


I manage to build the project with VS2008 SP1 (after correcting some API change issues)
I'm trying to run SchoolDemo and I noticed that edmx designer:cs file are in mode build action = false. Surprising but I think it is normal...
Now, when I try to invoke GetPerson Method I get the following NotSupportedException :
The specified type member 'PersonID' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
        using (SchoolContext context = new SchoolContext())
            Person p = (from person in context.Person                                                 <<------ NotSupportedException 
                        where person.PersonID  == id
                           select person).First();
            if (fetchEnrollments)
                foreach (Enrollment r in p.Enrollments)
Any idea ?
Thanks a lot for helping...


gherold wrote Oct 10, 2008 at 1:56 PM

Okay, I manage to find what was going wrong.
Now, I can read get data on the client. But if I try to persist, I get the error "The supplied EntityKey does not have a corresponding entry in the ObjectStateManager".
I try also with the EntityBag<T> framework and I have the same error.
Maybe it's due to the EF API change between :
  context.GetEntityKey dorsn't exists anymore that I replaced with context.CreateEntityKey
I did this change in both framework => same error,
Any idea someone ?

gherold wrote Oct 10, 2008 at 2:23 PM

Solution FOUND !

Replace : context.GetEntityKey(fullEntitySetName, target)


EntityKey targetKey;
EntityObject e = target as EntityObject;
if (e != null && e.EntityKey != null)
targetKey = e.EntityKey;
targetKey = context.CreateEntityKey(fullEntitySetName, target);

Now it works on VS2008 SP1

wrote Dec 4, 2008 at 5:28 AM

farooqmian wrote Dec 4, 2008 at 6:09 AM

I have faced the very same issues and seems like this project is dead.

wrote Feb 13, 2013 at 10:58 PM