Entity framework, POCO and a private property

c#, entity-framework, poco

Solution

In environments with sufficient levels of trust, reflection can be used to access members to which one would not normally have access.

Problem

I've created the following POCO class and also made `Contact.FirstName` and `Contact.LastName` properties private ( these properties are mapped to appropriate properties in an Entity Framework model ). ``` public class Contact { public int ContactID { get; set; } private string FirstName { get; set; } public string LastName { get; private set; } } ``` I expected to get an exception due to EF not being able to assign values to these two properties, but somehow EF still managed to assign values to them. How is that possible, since only code in `Contact` class should have accesses to private properties? Thank you

Original source