Tendril 0.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Tendril --version 0.4.0                
NuGet\Install-Package Tendril -Version 0.4.0                
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="Tendril" Version="0.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tendril --version 0.4.0                
#r "nuget: Tendril, 0.4.0"                
#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.
// Install Tendril as a Cake Addin
#addin nuget:?package=Tendril&version=0.4.0

// Install Tendril as a Cake Tool
#tool nuget:?package=Tendril&version=0.4.0                

Tendril

About

Tendril is a Normalized Data Access Layer (DAL) Package. This package provides a common CRUD interface for underlying collections of data. In addition to this functionality, Tendril also provides a common query language for decoupling consumption of data from the underlying persistence layer. This package is intended to be used in conjunction with the corresponding database type packages. These child packages provide functionalities for registering your datasources with Tendril. Some of these datasource specific packages include: Tendril.EFCore, Tendril.InMemory.

Examples

For all examples below, we will be using the following entity definition and dbcontext, note this example is also dependent on Tendril.EFCore for bootstrapping the collection to the DataManager.

public class Student {
	public int Id { get; set; }
	public string Name { get; set; }
}

public class StudentDbContext : DbContext {
	public DbSet<Student> Students { get; set; }
}

var findByFilterService = new LinqFindByFilterService<Student>()
	.WithFilterDefinition( s => s.Id, FilterOperator.EqualTo, v => s => s.Id == v.First() )
	.WithFilterDefinition( s => s.Name, FilterOperator.StartsWith, v => s => s.Name.StartsWith( v.Single() ) )
	.WithFilterDefinition( s => s.Name, FilterOperator.EqualTo, v => s => s.Name == v.Single() )
	.WithFilterDefinition( s => s.Name, FilterOperator.EndsWith, v => s => s.Name.EndsWith( v.Single() ) );

var filterValidator = new FilterChipValidatorService<Student>()
	.HasFilterType( s => s.Id, false, 1, 1, FilterOperator.EqualTo )
	.HasFilterType(
		s => s.Name, false, 1, 1,
		FilterOperator.StartsWith, FilterOperator.EqualTo, FilterOperator.EndsWith
	);

var dataManager = new DataManager()
	.WithDbContext( () => new StudentDbContext( new DbContextOptions() ) )
		.WithDbSet(
			db => db.Students,
			findByFilterService,
			filterValidator
		);

Create a new student with the name "John Doe"

var student = await dataManager.Create( new Student { Name = "John Doe" } );

Create multiple students in a batch

var students = new List<Student> {
	new Student { Name = "John Doe" },
	new Student { Name = "Jane Doe" }
};
await dataManager.CreateRange( students );

Insert a student and then change their name

var student = await dataManager.Create( new Student { Name = "John Doe" } );
student.Name = "John Lee Doe";
await dataManager.Update( student );

Delete a student from the collection

var student = await dataManager.Create( new Student { Name = "John Doe" } );
await dataManager.Delete( student );

Find a student who either has an ID equal to 5, or a name that starts with John and ends with Doe

var filters = new OrFilterChip(
	new ValueFilterChip<Student, int>( s => s.Id, FilterOperator.EqualTo, 5 ),
	new AndFilterChip(
		new ValueFilterChip<Student, string>( s => s.Name, FilterOperator.StartsWith, "John" ),
		new ValueFilterChip<Student, string>( s => s.Name, FilterOperator.EndsWith, "Doe" )
	)
);
var students = await DataManager.FindByFilter<Student>( filters );
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Tendril:

Package Downloads
Tendril.EFCore

Tendril.EFCore provides registration logic to use EFCore as the backing datasource for Tendril

Tendril.InMemory

Tendril.InMemory provides registration logic to use an InMemory cache as the backing datasource for Tendril

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.0 741 9/26/2022
0.4.0 693 9/17/2022
0.3.1 642 6/21/2022
0.3.0 510 6/20/2022
0.2.0 640 6/20/2022

Changed License type to MIT,
Reduced complexity of bootstrapping.
Added type checking to FilterChips and bootstrap extension methods.
Improved XML Comments