riteshrao / ncommon

A framework for implementing commonly used design patterns when using Domain Driven Design
www.codeinsanity.com
218 stars 61 forks source link

Query to Return Distinct Root Entity #5

Closed samuelgoldenbaum closed 13 years ago

samuelgoldenbaum commented 14 years ago

Think it would be good include a property like "WithDistinctRootEntity" to IRepository.

This would allow us to take advantage of the nhibernate transformers inside the RepositoryQuery:

if(_distinctRootEntity) { query.QueryOptions.RegisterCustomAction(x => x.SetResultTransformer(Transformers.DistinctRootEntity)); }

Any thoughts?

riteshrao commented 14 years ago

Added option to setup NH repository to use DistinctRootEntity transformer.

When configuring ncommon data providers with NHConfiguration you can use the following:

NCommon.Configure.Using(containerAdapter) .ConfigureData(config => config.WithSessionFactory(factory) .WithDistinctResults);

This is an application wide config, meaning all queries will use the DistinctRootEntity transformer.

riteshrao commented 13 years ago

Closing this issue.