chris_dotnet
chris_dotnet

Reputation: 854

Create Entity of specific columns

I am using Breeze (http://www.breezejs.com/) and to use the functionality I want it requires mapping to a complete entity and all of its fields. I have a "Person" entity, but it includes a Social Security Number field. I want to keep this SSN# field private so I would like to create an entity named SubSetPerson that is updateable, has navigation properties and only contains the columns I want (e.g. ID, FirstName, LastName, myNavigationProperty) and does not contain the SSN#. I am using database/model first. Is this possible?

Upvotes: 0

Views: 77

Answers (2)

David Laughlin
David Laughlin

Reputation: 600

Try using a Master-Detail type structure for your person. The master table would contain the person's public information; ie name, birthdate, etc... The detail table would contain only the more sensitive information (SSN, etc...). Then depending on your needs you can load the detail or not.

Upvotes: 0

Justin Bicknell
Justin Bicknell

Reputation: 4808

If you are using database first, then you could create a view for that table which only selects the columns you want. Then update the EF model browser to include that view.

Upvotes: 1

Related Questions