diff --git a/NDB.sln b/NDB.sln
index 5278b95..5818546 100644
--- a/NDB.sln
+++ b/NDB.sln
@@ -60,6 +60,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NDB.Test.Api", "NDB.Test.Ap
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NDB.Infrastructure.DatabaseMigration", "infrastructure\NDB.Infrastructure.DatabaseMigration\NDB.Infrastructure.DatabaseMigration.csproj", "{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDB.Data.EntityFramework", "src\data\NDB.Data.EntityFramework\NDB.Data.EntityFramework.csproj", "{15650720-30F3-4FF3-8D4A-9B21BBA5E273}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{FD5D4A32-E6A7-4808-B43E-A906B1B81956}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDB.Core.Abstractions", "src\core\NDB.Core.Abstractions\NDB.Core.Abstractions.csproj", "{A15F25DD-2B42-49AB-BBA8-E9D9B78630A1}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -110,6 +116,14 @@ Global
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {15650720-30F3-4FF3-8D4A-9B21BBA5E273}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {15650720-30F3-4FF3-8D4A-9B21BBA5E273}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {15650720-30F3-4FF3-8D4A-9B21BBA5E273}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {15650720-30F3-4FF3-8D4A-9B21BBA5E273}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A15F25DD-2B42-49AB-BBA8-E9D9B78630A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A15F25DD-2B42-49AB-BBA8-E9D9B78630A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A15F25DD-2B42-49AB-BBA8-E9D9B78630A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A15F25DD-2B42-49AB-BBA8-E9D9B78630A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -138,6 +152,9 @@ Global
{CCEE458E-02A8-42FD-8F5F-A35481A23303} = {E0202271-4E92-4DB8-900D-B5FD745B9278}
{F717BE3D-F5F4-4D99-B96D-D0A23E8BED01} = {CCEE458E-02A8-42FD-8F5F-A35481A23303}
{74C7BE02-DD5C-49C2-8E88-E3AEA729E2AB} = {1C1D634E-06CC-4707-9564-E31A76F27D9E}
+ {15650720-30F3-4FF3-8D4A-9B21BBA5E273} = {7D49E538-B89A-4BC2-AD5A-5A658F4B74E4}
+ {FD5D4A32-E6A7-4808-B43E-A906B1B81956} = {E0202271-4E92-4DB8-900D-B5FD745B9278}
+ {A15F25DD-2B42-49AB-BBA8-E9D9B78630A1} = {FD5D4A32-E6A7-4808-B43E-A906B1B81956}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87541BAB-3FAC-4ADB-A7FB-8228DA87843D}
diff --git a/Notes.txt b/Notes.txt
index f252cae..2471409 100644
--- a/Notes.txt
+++ b/Notes.txt
@@ -22,4 +22,7 @@ dotnet nuget push NDB.Security.Authentication.Identity.1.0.7.nupkg -k ****KEY***
dotnet nuget push NDB.Extensions.Caching.1.0.1.nupkg -k ****KEY**** -s https://toodle.ddns.net/public-nuget-server/nuget
dotnet nuget push NDB.Infrastructure.DatabaseMigration.1.1.3.nupkg -k ****KEY**** -s https://toodle.ddns.net/public-nuget-server/nuget
+
+dotnet nuget push NDB.Data.EntityFramework.1.0.1.nupkg -k ****KEY**** -s https://toodle.ddns.net/public-nuget-server/nuget
+dotnet nuget push NDB.Core.Abstractions.1.0.0.nupkg -k ****KEY**** -s https://toodle.ddns.net/public-nuget-server/nuget
#######################################################################################################################################################
\ No newline at end of file
diff --git a/src/core/NDB.Core.Abstractions/NDB.Core.Abstractions.csproj b/src/core/NDB.Core.Abstractions/NDB.Core.Abstractions.csproj
new file mode 100644
index 0000000..e2dc869
--- /dev/null
+++ b/src/core/NDB.Core.Abstractions/NDB.Core.Abstractions.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net5.0
+ NDB core abstractions
+ NDB core abstractions
+ https://toodle.ddns.net/gitea/bricks/ndb
+ https://toodle.ddns.net/gitea/bricks/ndb
+ Git
+ NDB Core
+ 1.0.0
+
+
+
diff --git a/src/core/NDB.Core.Abstractions/Paging/PageRequest.cs b/src/core/NDB.Core.Abstractions/Paging/PageRequest.cs
new file mode 100644
index 0000000..11553c5
--- /dev/null
+++ b/src/core/NDB.Core.Abstractions/Paging/PageRequest.cs
@@ -0,0 +1,14 @@
+namespace NDB.Core.Abstractions.Paging
+{
+ public class PageRequest
+ {
+ public int Page { get; }
+ public int PageSize { get; }
+
+ public PageRequest(int page, int pageSize)
+ {
+ Page = page <= 0 ? 1 : page;
+ PageSize = pageSize <= 0 ? 10 : pageSize;
+ }
+ }
+}
diff --git a/src/core/NDB.Core.Abstractions/Paging/PagedResult.cs b/src/core/NDB.Core.Abstractions/Paging/PagedResult.cs
new file mode 100644
index 0000000..932e4b0
--- /dev/null
+++ b/src/core/NDB.Core.Abstractions/Paging/PagedResult.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace NDB.Core.Abstractions.Paging
+{
+ public class PagedResult
+ {
+ public int Page { get; }
+ public int PageSize { get; }
+ public int TotalCount { get; }
+ public int TotalPages { get; }
+ public IEnumerable Values { get; }
+
+ public PagedResult(int page, int pageSize, int totalCount, int totalPages, IEnumerable values)
+ {
+ Page = page;
+ PageSize = pageSize;
+ TotalCount = totalCount;
+ TotalPages = totalPages;
+ Values = values;
+ }
+
+ public PagedResult Map(Func mapperFunc)
+ {
+ return new PagedResult(Page, PageSize, TotalCount, TotalPages, Values.Select(mapperFunc));
+ }
+ }
+}
diff --git a/src/data/NDB.Data.EntityFramework/Extensions/LinqExtensions.cs b/src/data/NDB.Data.EntityFramework/Extensions/LinqExtensions.cs
new file mode 100644
index 0000000..fd45a64
--- /dev/null
+++ b/src/data/NDB.Data.EntityFramework/Extensions/LinqExtensions.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Linq;
+using System.Linq.Expressions;
+
+namespace NDB.Data.EntityFramework.Extensions
+{
+ public static class LinqExtensions
+ {
+ public static IOrderedQueryable OrderBy(this IQueryable source, Expression> keySelector, bool descending)
+ {
+ return descending ? source.OrderByDescending(keySelector) : source.OrderBy(keySelector);
+ }
+ }
+}
diff --git a/src/data/NDB.Data.EntityFramework/Extensions/PagedResultExtensions.cs b/src/data/NDB.Data.EntityFramework/Extensions/PagedResultExtensions.cs
new file mode 100644
index 0000000..548766d
--- /dev/null
+++ b/src/data/NDB.Data.EntityFramework/Extensions/PagedResultExtensions.cs
@@ -0,0 +1,25 @@
+using Microsoft.EntityFrameworkCore;
+using NDB.Core.Abstractions.Paging;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace NDB.Data.EntityFramework.Extensions
+{
+ public static class PagedResultExtensions
+ {
+ public static async Task> ToPagedResult(this IQueryable query, PageRequest pageRequest, CancellationToken cancellationToken = default)
+ {
+ var page = pageRequest.Page;
+ var pageSize = pageRequest.PageSize;
+
+ var totalCount = await query.CountAsync(cancellationToken);
+ var values = await query.Skip(pageSize * (page - 1)).Take(pageSize).ToArrayAsync(cancellationToken);
+
+ var totalPages = totalCount / pageSize + (totalCount % pageSize > 0 ? 1 : 0);
+
+ var result = new PagedResult(page, pageSize, totalCount, totalPages, values);
+ return result;
+ }
+ }
+}
diff --git a/src/data/NDB.Data.EntityFramework/NDB.Data.EntityFramework.csproj b/src/data/NDB.Data.EntityFramework/NDB.Data.EntityFramework.csproj
new file mode 100644
index 0000000..f9ca3d2
--- /dev/null
+++ b/src/data/NDB.Data.EntityFramework/NDB.Data.EntityFramework.csproj
@@ -0,0 +1,22 @@
+
+
+
+ net5.0
+ EntityFramework extensions
+ EntityFramework extensions
+ https://toodle.ddns.net/gitea/bricks/ndb
+ https://toodle.ddns.net/gitea/bricks/ndb
+ Git
+ NDB EntityFramework
+ 1.0.1
+
+
+
+
+
+
+
+
+
+
+