문제

So with S#arp Architecture, if you have a (say) Dog Entity which has a one-to-many relationship with a Trick Entity, how do you keep the collection in sync when adding objects etc?

That is, if there is a Dog.Tricks collection, and you want to add a new Trick, whats the best practice?

In general the approach with NHibernate seems to be to hide the mutable Tricks collection (that NHibernate binds to) and show an immutable IEnumberable one. See this question for a discussion of the technique: Best practice for Handling NHibernate parent-child collections. This seems like a nice tidy way to ensure that there's only one way to add tricks - via a dog.AddTrick() method - and keep the collections in sync.

But it seems that because S#arp uses Fluent, this approach is not so easy to implement (unless I've missed something?)

So whats the equivalent best practice for S#arp?

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top