Makes sense to me
Niclas Hedhman a écrit :
> Hi again,
> While looking into the feasibility of implementing a Repository EntityStore
> I realized that the current SPI seems flawed.
>
> The TYPE of an entity is stored with the entity and not the entity type
> that is being processed by the outside world. And then type lookup is used
> via the current Module associated to the current UnitOfWork.
>
> It seems more logical to me that an EnttyDscriptor is passed down to the
> EntityStore, so that the type doesn't need to be looked up. For ES, this
> seems to work well, although this doesn't solve a similar issue in the
> Query system.
>
> I would like to change the EntityStoreSPI from
>
>
> public interface EntityStoreSPI
> {
> EntityState newEntityState( EntityStoreUnitOfWork unitOfWork,
> EntityReference identity,
> EntityDescriptor entityDescriptor
> );
>
> EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork,
> ModuleDescriptor module,
> EntityReference identity );
>
> String versionOf( EntityStoreUnitOfWork unitOfWork,
> EntityReference identity );
>
> StateCommitter applyChanges( EntityStoreUnitOfWork unitOfWork,
> Iterable<EntityState> state );
> }
>
> to
>
> public interface EntityStoreSPI
> {
> EntityState newEntityState( EntityStoreUnitOfWork unitOfWork,
> EntityReference identity,
> EntityDescriptor entityDescriptor
> );
>
> EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork,
> EntityReference identity,
> EntityDescriptor entityDescriptor );
>
> String versionOf( EntityStoreUnitOfWork unitOfWork,
> EntityReference identity,
> EntityDescriptor entityDescriptor );
>
> StateCommitter applyChanges( EntityStoreUnitOfWork unitOfWork,
> Iterable<EntityState> state );
> }
>
>
> which I think can handle the requirements of Repository ES more elegantly.
>
> WDYT?
>
> Cheers