EntityFrameworkIncludeBuilder 3.0.0

EntityFrameworkIncludeBuilder is an Entity Framework Core extensions which provide ability to build dynamically Include/ThenInclude chain.

Install-Package EntityFrameworkIncludeBuilder -Version 3.0.0
dotnet add package EntityFrameworkIncludeBuilder --version 3.0.0
<PackageReference Include="EntityFrameworkIncludeBuilder" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EntityFrameworkIncludeBuilder --version 3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

EntityFrameworkIncludeBuilder

NuGet
NuGet
.NET Core

EntityFrameworkIncludeBuilder is an Entity Framework Core extensions which provide ability to build dynamically Include/ThenInclude chain.

Usage

1. Define repository method.

We add method which provide ability to get all items of TEntity type and specify all necessary navigation properties. The user can specify only those navigation properties that he will use.

// ...
using EntityFrameworkIncludeBuilder;
// ...
{
  // ...
  public IEnumerable<TEntity> GetAll<TEntity>(
          Expression<Func<IEnumerable<TEntity>, 
          ILoadCollection<TEntity, object>>> includes = null)
  {
      var query = Table.AsQueryable(); //  DbSet<TEntity>
      return includes == null
          ? query
          : query.Include(includes);
  }
  // ...
}

2. Sample

//...
var items = _repository
      .GetAll(collection => collection.Load(x => x.Property1)
                                      .Load(x => x.Collection1)
                                        .ThenLoad(x => x.Property2)
                                          .ThenLoad(x => x.Property3));
//...

Contribute

One of the easiest ways to contribute is to report issues and participate in discussions on issues. You can also contribute by submitting pull requests with code changes and supporting tests.

License

MIT

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

paypal

EntityFrameworkIncludeBuilder

NuGet
NuGet
.NET Core

EntityFrameworkIncludeBuilder is an Entity Framework Core extensions which provide ability to build dynamically Include/ThenInclude chain.

Usage

1. Define repository method.

We add method which provide ability to get all items of TEntity type and specify all necessary navigation properties. The user can specify only those navigation properties that he will use.

// ...
using EntityFrameworkIncludeBuilder;
// ...
{
  // ...
  public IEnumerable<TEntity> GetAll<TEntity>(
          Expression<Func<IEnumerable<TEntity>, 
          ILoadCollection<TEntity, object>>> includes = null)
  {
      var query = Table.AsQueryable(); //  DbSet<TEntity>
      return includes == null
          ? query
          : query.Include(includes);
  }
  // ...
}

2. Sample

//...
var items = _repository
      .GetAll(collection => collection.Load(x => x.Property1)
                                      .Load(x => x.Collection1)
                                        .ThenLoad(x => x.Property2)
                                          .ThenLoad(x => x.Property3));
//...

Contribute

One of the easiest ways to contribute is to report issues and participate in discussions on issues. You can also contribute by submitting pull requests with code changes and supporting tests.

License

MIT

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

paypal

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.0.0 131 3/31/2020
2.0.0 127 3/31/2020