Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Query to Return Distinct Root Entity #5

Closed
samuelgoldenbaum opened this issue May 16, 2010 · 2 comments
Closed

Query to Return Distinct Root Entity #5

samuelgoldenbaum opened this issue May 16, 2010 · 2 comments

Comments

@samuelgoldenbaum
Copy link

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
Copy link
Owner

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
Copy link
Owner

Closing this issue.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants