Note that there are some explanatory texts on larger screens.

plurals
  1. PORepositories and persistence ignorance again
    primarykey
    data
    text
    <p>Here's where I'm up to. </p> <p>I have a generic Repository class <code>Repository&lt;TKey, TValue&gt;</code>. It has the usual Repository pattern methods.</p> <p>Each Repository takes an <code>IContext&lt;TKey, TValue&gt;</code> in its constructor which provides the persistence for the repository.</p> <p>I have specialised repositories which are composed of a generic Repository and then methods tailored to repository actions that are specific to the specialised object. So if I had a specialised repository for Kitten objects, It would have methods to ClimbTree (probably taking a tree object) but not a BuryBone(Bone bone) method. The point I'm making badly is It creates an association between the kitten and its tree which needs to be persisted. <code>void CleanWhiskers()</code> might be a simpler example. This sets the Kittens whiskers to clean.</p> <p>So I'm now thinking of a scheme for related child objects persistence and starting to wonder if I'm already going a bit wrong. </p> <p>I started with slightly ugly methods on the repository to create child objects. So Kitten repository would have a method <code>CreateFurBall()</code> which would add a FurBall object to the Kitten's FurBall collection AND add a Furball to the FurBall Repository to be persisted (Actually the same object). </p> <p>I've now changed to a system where I have something akin to an ObservableCollection which notifies its parent repository when a POCO is added. So I can just create a POCO furball and added it to the collection which would then be automatically registered with the furball repository.</p> <p>First off I'll have nHibernate implemented in the contexts, I think this maps fairly well. This is a really open question, for anyone that's been down this route before, can you see anything that makes you go "STOP!!"</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload