Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetAllIncluding method to repositories #422

Closed
oliviercpl opened this issue Mar 25, 2015 · 3 comments
Closed

Add GetAllIncluding method to repositories #422

oliviercpl opened this issue Mar 25, 2015 · 3 comments
Milestone

Comments

@oliviercpl
Copy link

oliviercpl commented Mar 25, 2015

I things you can add implementation of Include in repositories.
For all "Select" functions , we can add an expression parameter to specify includes.

ex:

        public override IQueryable<TEntity> GetAllList(params Expression<Func<TEntity, object>>[] includes)
        {
            var query = Table;
            foreach (var include in includes)
            {
                query = GetQuery().Include(include);
            }
            return query.ToList();
        }    

Usage:

RepositoryAdresse.GetAll( a=> a.User, a=> a.Object1 ) return à list of Adress with User & Object1 entity

@hikalkan
Copy link
Member

Only problem with multiple include is, NHibernate does not support it. It's supported only by Entity Framework. If you think that you will not change EF, then reference EF from your application (and optionlly from core) layer and use Repository.GetAll().Include(...);

@hikalkan hikalkan added this to the After ABP v1.0.0 milestone May 5, 2015
@hikalkan
Copy link
Member

hikalkan commented May 5, 2015

I'll consider it after v1.0. Thanks.

@vitorlacerda
Copy link

Halil, I don't know nothing about nhibernate, but I think is possible to encapsulating Query Logic with the Query Object pattern and use include without reference EF on app/core.
I'm not sure about that but I think is possible and this is a good pattern.
Check this implementation

https://genericunitofworkandrepositories.codeplex.com/wikipage?title=Encapsulating%20Query%20Logic%20with%20the%20Query%20Object%20Pattern%20%28Reusable%20Queries%29&referringTitle=Documentation

@hikalkan hikalkan modified the milestones: v0.11.0, After v1.0.0 Jul 22, 2016
@hikalkan hikalkan modified the milestones: v0.11.0, v0.10.3 Jul 26, 2016
@hikalkan hikalkan changed the title Implement include in repositories Add GetAllIncluding method to repositories Jul 27, 2016
KenProDev pushed a commit to KenProDev/aspnetboilerplate that referenced this issue Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants