CSESoftware.Repository 3.0.0-beta03

This is a prerelease version of CSESoftware.Repository.
dotnet add package CSESoftware.Repository --version 3.0.0-beta03
                    
NuGet\Install-Package CSESoftware.Repository -Version 3.0.0-beta03
                    
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="CSESoftware.Repository" Version="3.0.0-beta03" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSESoftware.Repository" Version="3.0.0-beta03" />
                    
Directory.Packages.props
<PackageReference Include="CSESoftware.Repository" />
                    
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 CSESoftware.Repository --version 3.0.0-beta03
                    
#r "nuget: CSESoftware.Repository, 3.0.0-beta03"
                    
#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 CSESoftware.Repository@3.0.0-beta03
                    
#: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=CSESoftware.Repository&version=3.0.0-beta03&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CSESoftware.Repository&version=3.0.0-beta03&prerelease
                    
Install as a Cake Tool

CSESoftware.Repository

A generic repository pattern.

Note: This defines the interfaces. For implimentations, please see CSESoftware.Repository.EntityFramework or CSESoftware.EntityFrameworkCore


Instructions for using the Query Builder

All below queries assume the following class structure:

public class User : BaseEntity<Guid>
{
	public string Name { get; set; }
	public string AddressOne { get; set; }
	public string AddressTwo { get; set; }
	public string City { get; set; }
	public string State { get; set; }
	public string Zip { get; set; }
	public string Phone { get; set; }
	public string SecondaryPhone { get; set; }
	public string Initials { get; set; }
	public Department Department { get; set; }
}

public class Department : BaseEntity<Guid>
{
	public string Name { get; set; }
}

Basic query with a predicate:

public async Task Query()
{
	var inActiveUsersQuery = new QueryBuilder<User>()
		.Where(x => x.IsActive == false)
		.Build();

	var inActiveUsers = await repository.GetAllAsync(inActiveUsersQuery);
}

Query with a join to another entity:

public async Task Join()
{
	var inActiveUsersWithDepartmentsQuery = new QueryBuilder<User>()
		.Where(x => x.IsActive == false)
		.Include(x => x.Department)
		.Build();

	var inActiveUsersWithDepartments = await _repository.GetAllAsync(inActiveUsersWithDepartmentsQuery);
}

Pagination with skip/take:

public async Task Paginate()
{
	var paginateInActiveUsersQuery = new QueryBuilder<User>()
		.Where(x => x.IsActive == false)
		.Skip(5)
		.Take(10)
		.Build();

	var paginatedInActiveUsers = await _repository.GetAllAsync(paginateInActiveUsersQuery);
}

Ordering query results:

public async Task Order()
{
	var orderUsersQuery = new QueryBuilder<User>()
		.OrderBy(x => x.Name)
		.ThenByDescending(x => x.AddressOne)
		.Build();

	var orderedUsers = await _repository.GetAllAsync(orderUsersQuery);
}

Specifying columns to be returned:

public async Task SpecifyReturn()
{
	var nameOfInactiveUsersQuery = new QueryBuilder<User>()
		.Where(x => x.IsActive == false)
		.Select(x => x.Name)
		.Build();

	var nameOfInactiveUsers = await _repository.GetAllWithSelectAsync(nameOfInactiveUsersQuery);
}

Queries can be saved through concrete classes and reused later:

public class UserQueries
{
	public IQuery<User> GetAllInactiveUsers()
	{
		return new QueryBuilder<User>()
			.Where(x => x.IsActive == false)
			.Build();
	}

	public IQuery<User> GetAllInactiveUsersWithDepartment()
	{
		return new QueryBuilder<User>()
			.Where(x => x.IsActive == false)
			.Include(x => x.Department)
			.Build();
	}
}

CSE Software Inc. is a privately held company founded in 1990. CSE develops software, AR/VR, simulation, mobile, and web technology solutions. The company also offers live, 24x7, global help desk services in 110 languages. All CSE teams are U.S. based with experience in multiple industries, including government, military, healthcare, construction, agriculture, mining, and more. CSE Software is a certified women-owned small business. Visit us online at csesoftware.com.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on CSESoftware.Repository:

Package Downloads
CSESoftware.Repository.EntityFrameworkCore

The Entity Framework Core implementation of CSESoftware.Repository.

CSESoftware.OData

Library to convert Open Data REST API queries into queries for CSESoftware.Repository.

CSESoftware.Repository.EntityFramework

The Entity Framework implementation of CSESoftware.Repository.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-beta03 163 3/5/2026
2.5.1 1,669 5/15/2025
2.5.0 2,231 6/5/2024
2.4.0 4,072 12/14/2023
2.3.0 1,071 9/6/2023
2.2.0 2,426 9/22/2022
2.1.1 6,667 2/25/2021
2.1.0 5,701 11/24/2020
2.0.0 2,711 7/23/2020
1.1.0 1,031 5/14/2020
1.0.0 2,027 5/2/2020