LinqExtentions-Adavanced 1.0.6

dotnet add package LinqExtentions-Adavanced --version 1.0.6
NuGet\Install-Package LinqExtentions-Adavanced -Version 1.0.6
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="LinqExtentions-Adavanced" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LinqExtentions-Adavanced --version 1.0.6
#r "nuget: LinqExtentions-Adavanced, 1.0.6"
#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 LinqExtentions-Adavanced as a Cake Addin
#addin nuget:?package=LinqExtentions-Adavanced&version=1.0.6

// Install LinqExtentions-Adavanced as a Cake Tool
#tool nuget:?package=LinqExtentions-Adavanced&version=1.0.6

Linq Extentions

c# Library that collects some advanced functions that uses linq to extend exist classs and functionality Like "Where" function, my aim is to write less code with more functionality and make code more readable


Supported Linq

Where Functions :
WhereIf :

Extendes Where Condition by adding if coinditon as first paramter so if result of the condition is true then the filter is applied.

WhereNoNull :

Checks If The First Paramter Is Not null It Applies The Second Paramter ( condition ) To The Query.

WhereAny :

If Any Of First Paramter Equals true, then the second one is applied.

WhereBulk:

If first Paramter Is true then the function passes querable to second parm to other conditions for example:

Query.WhereBulk(ApplyCondition, query => {
    query.WhereIf(filterBalance, x => x.Balance > minBalance) ,
    query.WhereIf(filterQuqnatity, x => x.Quantity > minQuantity) , 
});

Order Functions
OrderByIf , OrderByDescendingIf

It order by sepicfied property if first condition is apllied

ThenByIf , ThenByDescendingIf

It Continue Operation Of Ordering Based On Condition.


List Functions
TakeTop

It Take First Element From Array Then Removes It From The List.

ToTree

Converts Flat List Into Tree By Providing Some Info To Build The Tree

Id Property, Parent Id Property, Childs Property That Will Be Used To Add Childs to it.

FlattenList

Converts Tree Data Structure Into Flat List Be Providing Child Property.

ToPagedList

Extends IQuerable to Make Paging Easly It take two paramters first is page with default page (0) and

count of items per page (10) and returns tuple contains page items as first item and total items as second item.


IEnumrable
HasAtLeast, HasAtMost, HasExactly

functions used to check for count of items.

Each

Loop Over Items

PickRandom

Picks Random Items From List And Returns It

Repeate

It Repeats Items In Array for N Count

Exclude

It Exclude Item From Array


Repository
RegisterBaseRepository

Extends IServiceCollection To Register IBaseRepository Interface Which Generate Genrice Repository For DbContext Models

Services.RegisterBaseRepository<ClientsDbContext>();

Or You Can Use

Services.RegisterBaseRepository<ClientsDbContext>(a =>
{
    a.Configure(x => x.Clients, x => x.AutoInclude(
        d => d.Address, 
        d => d.PersonalInfo
    ));
});

As you can note you can make some properties loaded in each repository query by use AutoInclude Function.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
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
1.0.6 173 4/9/2023
1.0.5 164 4/2/2023
1.0.3 224 2/18/2023
1.0.2 237 2/11/2023
1.0.1 234 2/3/2023
1.0.0 269 1/29/2023