LinqExtentions-Adavanced
1.0.6
dotnet add package LinqExtentions-Adavanced --version 1.0.6
NuGet\Install-Package LinqExtentions-Adavanced -Version 1.0.6
<PackageReference Include="LinqExtentions-Adavanced" Version="1.0.6" />
paket add LinqExtentions-Adavanced --version 1.0.6
#r "nuget: LinqExtentions-Adavanced, 1.0.6"
// 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 | Versions 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. |
-
net5.0
- Microsoft.EntityFrameworkCore (>= 5.0.17)
- Microsoft.Extensions.Caching.Memory (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.