Can I hide my ICollection<T> fields when I have a one-to-many mapping in EF4 code-only?
问题 My domain classes that have one-to-many mappings generally take the following form (untested code): public Customer Customer { // Public methods. public Order AddOrder(Order order) { _orders.Add(order); } public Order GetOrder(long id) { return _orders.Where(x => x.Id).Single(); } // etc. // Private fields. private ICollection<Order> _orders = new List<Order>(); } The EF4 code-only samples I've seen expose a public ICollection when dealing with one-to-many relationships. Is there a way to