Hi friends! I'd like to know, How Could I map (with fluent nhibernate) this model:
public class Category
{
private IList<Product> _products;
public IEnumerable<Product> Products {
get { return _products; }
}
/* others properties */
public Category() {
_products = new List<Product>();
}
// to add a product i'd use something like this:
public void AddProducts(Product product) {
product.Category = this;
_products.Add(products);
}
}
Today, I'm using a property of IList, but I don't want to expose the methods like "Add", "Remove", etc... on my property, So I think to expose a simple property of IEnumerable and encapsulate an IList like a private field!
So, Is it a good pratice ? How could I map it using NHibernate?
Thanks
Cheers