How can I hide a database column in the entity model?

Posted by Nick Butler on Stack Overflow See other posts from Stack Overflow or by Nick Butler
Published on 2010-05-16T10:12:52Z Indexed on 2010/05/16 10:20 UTC
Read the original article Hit count: 385

Hi. I'm using the Entity Framework 4 and have a question:

I have a password column in my database that I want to manage using custom SQL. So I don't want the model to know anything about it.

I've tried deleting the property in the Mapping Details window, but then I got a compilation error:

Error 3023: Problem in mapping fragments starting at line 1660:Column User.Password in table User must be mapped: It has no default value and is not nullable.

So, I made the column nullable in the database and updated the model. Now I get this error:

Error 3004: Problem in mapping fragments starting at line 1660:No mapping specified for properties User.Password, User.Salt in Set Users. An Entity with Key (PK) will not round-trip when: Entity is type [UserDirectoryModel.User]

Any ideas please?

Thanks, Nick

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about entity-framework-4