YouBIM.Common.Repository.Lib.EntityFramework 9.0.14

dotnet add package YouBIM.Common.Repository.Lib.EntityFramework --version 9.0.14
                    
NuGet\Install-Package YouBIM.Common.Repository.Lib.EntityFramework -Version 9.0.14
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YouBIM.Common.Repository.Lib.EntityFramework" Version="9.0.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YouBIM.Common.Repository.Lib.EntityFramework" Version="9.0.14" />
                    
Directory.Packages.props
<PackageReference Include="YouBIM.Common.Repository.Lib.EntityFramework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add YouBIM.Common.Repository.Lib.EntityFramework --version 9.0.14
                    
#r "nuget: YouBIM.Common.Repository.Lib.EntityFramework, 9.0.14"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package YouBIM.Common.Repository.Lib.EntityFramework@9.0.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=YouBIM.Common.Repository.Lib.EntityFramework&version=9.0.14
                    
Install as a Cake Addin
#tool nuget:?package=YouBIM.Common.Repository.Lib.EntityFramework&version=9.0.14
                    
Install as a Cake Tool

YouBIM.Common.Repository.Lib

Description

Base repository abstractions for Entity Framework Core providing standardized data access patterns across YouBIM microservices.

Requirements

  • .NET 6/8
  • Entity Framework Core

Installation

dotnet restore

Usage

Entity Framework Core

To use the Entity Framework Core base repository, simply inherit from the 'BaseRepository<TEntity>' class.

using YouBIM.Common.Repository.Lib.EntityFramework;

public class UserRepository : BaseRepository<User>
{
    public UserRepository(DbContext context) : base(context)
    {
    }
}

New Methods params

  • GetQuery(Expression<Func<TEntity, bool>> filter, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy, params Expression<Func<TEntity, object>>[] includes)

Advanced Usage with includesProperties in V2

You can use the GetQuery method to retrieve a queryable object with filtering, ordering, and eager loading of related entities. Here's an example:

using YouBIM.Common.Repository.Lib.EntityFramework;
using System.Linq.Expressions;

public class UserService
{
    private readonly UserRepository _userRepository;

    public UserService(UserRepository userRepository)
    {
        _userRepository = userRepository;
    }

    public void GetUserDetails()
    {
        // first option
        Expression<Func<User, bool>> filter = user => user.IsActive;
        Func<IQueryable<User>, IOrderedQueryable<User>> orderBy = q => q.OrderBy(u => u.LastName);
        Expression<Func<User, object>>[] includes = new Expression<Func<User, object>>[]
        {
			w => w.WorkorderLocations, // Includes
			w => w.WorkorderLocations.Select(wl => wl.Location), // Includes nested
			w => w.WorkorderLocations.Select(wl => wl.Location.ApplicationConfigsLocations), // Includes nested
			w => w.WorkorderLocations.Select(wl => wl.Location.ApplicationConfigsLocations.Select(acl => acl.ApplicationConfig)), // Includes nested
        };

        var query = _userRepository.GetQuery(filter, orderBy, includes);

        //second option
        var query2 = _userRepository.GetQuery(
                             user => user.IsActive, // filter
                             u => u.LastName, // ordeBy
                             w => w.WorkorderLocations, // Includes
							 w => w.WorkorderLocations.Select(wl => wl.Location), // Includes nested
							 w => w.WorkorderLocations.Select(wl => wl.Location.ApplicationConfigsLocations), // Includes nested
							 w => w.WorkorderLocations.Select(wl => wl.Location.ApplicationConfigsLocations.Select(acl => acl.ApplicationConfig)), // Includes nested
                            ); 
    }
}

In this example, we're using the GetQuery method to:

  • Filter active users (filter)
  • Order them by their last name (orderBy)
  • Eagerly load their Address and Orders related entities (includes).

Note: The includes parameter now uses strongly-typed expressions instead of string-based navigation properties, providing better type safety and refactoring support.


NuGet publishing via pipeline

See the organization guide for building and publishing this library to NuGet via CI:

How to Create and Publish a Nuget Package via Pipeline (Confluence) https://youbimers.atlassian.net/wiki/spaces/YS/pages/2629435399/How+to+Create+and+Publish+a+Nuget+Package+via+Pipeline

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.14 116 3/26/2026
9.0.12 158 2/4/2026
9.0.6 274 6/26/2025
8.0.17 113 2/3/2026
8.0.13.1 221 2/28/2025
8.0.13 200 2/17/2025
8.0.0 161 2/14/2025
2.0.1 227 11/5/2024
2.0.0 198 11/4/2024