AjitChahal
AjitChahal

Reputation: 271

Entity Framework 4.1 adds a GUID to entity object returned from DB

I have a strange problem when using Entity Framework code first.

When I return an object with dbContext.Users.Where... I don't get the User defined in my model, but User_{GUID}.

Is there anyone who knows this phenomenon and can help?

Regards, Ajit

Upvotes: 1

Views: 90

Answers (1)

Maxim V. Pavlov
Maxim V. Pavlov

Reputation: 10509

If your dbContext.Users if of a type DbSet<User> then you would get a User-castable type instance if you query Users collection.

User_{GUID} looks like a dynamic proxy object to a User instance in your DbContext. Treat it as if it was a User instance.

Upvotes: 1

Related Questions