KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Domain Model I am working on has root aggregate and child entities. Something like the following code: class Order { IList<OrderLine> Lines {get;set;} } class OrderLine { } Now I want my Order to control lines. Something like that: class Order { OrderLine[] Lines {get;} void AddLine(OrderLine line); } At this time we are using the following pattern: class Order { private IList<OrderLine> lines = new List<OrderLine>(); OrderLine[] Lines {get {return this.lines;}} void AddLine(OrderLine line) { this.orders.Add(line); { } NHibernate is mapped directly to the lines field. Now questions... What do you practice in such situations? Does anyone use methods: public IEnumerable GetLines() What are you using as return type for property? May be ReadOnlyCollection or IEnumerable; May be this is not the best place to ask? Suggest please. Update: Seems IEnumerable wins, however solution still is not perfect...
Tags (comma-separated)
Save Edits
Cancel