diff --git a/DotBased.AspNet.Authority.EFCore/AuthorityContext.cs b/DotBased.AspNet.Authority.EFCore/AuthorityContext.cs new file mode 100644 index 0000000..fc470a6 --- /dev/null +++ b/DotBased.AspNet.Authority.EFCore/AuthorityContext.cs @@ -0,0 +1,12 @@ +using DotBased.AspNet.Authority.Models.Authority; +using Microsoft.EntityFrameworkCore; + +namespace DotBased.AspNet.Authority.EFCore; + +public class AuthorityContext : DbContext +{ + public DbSet Attributes { get; set; } + public DbSet Groups { get; set; } + public DbSet Roles { get; set; } + public DbSet Users { get; set; } +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority.EFCore/DotBased.AspNet.Authority.EFCore.csproj b/DotBased.AspNet.Authority.EFCore/DotBased.AspNet.Authority.EFCore.csproj new file mode 100644 index 0000000..56e1802 --- /dev/null +++ b/DotBased.AspNet.Authority.EFCore/DotBased.AspNet.Authority.EFCore.csproj @@ -0,0 +1,17 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + diff --git a/DotBased.AspNet.Authority.EFCore/Repositories/RoleRepository.cs b/DotBased.AspNet.Authority.EFCore/Repositories/RoleRepository.cs new file mode 100644 index 0000000..6a1b1d8 --- /dev/null +++ b/DotBased.AspNet.Authority.EFCore/Repositories/RoleRepository.cs @@ -0,0 +1,12 @@ +using DotBased.AspNet.Authority.Models.Authority; +using DotBased.AspNet.Authority.Repositories; + +namespace DotBased.AspNet.Authority.EFCore.Repositories; + +public class RoleRepository : IRoleRepository +{ + public Task> GetRolesAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Repositories/IRoleRepository.cs b/DotBased.AspNet.Authority/Repositories/IRoleRepository.cs index 436076b..69ab90d 100755 --- a/DotBased.AspNet.Authority/Repositories/IRoleRepository.cs +++ b/DotBased.AspNet.Authority/Repositories/IRoleRepository.cs @@ -1,6 +1,8 @@ +using DotBased.AspNet.Authority.Models.Authority; + namespace DotBased.AspNet.Authority.Repositories; public interface IRoleRepository { - + public Task> GetRolesAsync(int limit = 20, int offset = 0, string search = "", CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/DotBased.sln b/DotBased.sln index b867aa7..bdaa262 100755 --- a/DotBased.sln +++ b/DotBased.sln @@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotBased.AspNet.Authority", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotBased.Data", "DotBased.Data\DotBased.Data.csproj", "{2DF9FEEF-5A60-4B41-9B5F-F883DCE33EF4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotBased.AspNet.Authority.EFCore", "DotBased.AspNet.Authority.EFCore\DotBased.AspNet.Authority.EFCore.csproj", "{F1F3F60B-911F-4036-8A2B-CEC18A8F59DD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -66,6 +68,10 @@ Global {2DF9FEEF-5A60-4B41-9B5F-F883DCE33EF4}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DF9FEEF-5A60-4B41-9B5F-F883DCE33EF4}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DF9FEEF-5A60-4B41-9B5F-F883DCE33EF4}.Release|Any CPU.Build.0 = Release|Any CPU + {F1F3F60B-911F-4036-8A2B-CEC18A8F59DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1F3F60B-911F-4036-8A2B-CEC18A8F59DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1F3F60B-911F-4036-8A2B-CEC18A8F59DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1F3F60B-911F-4036-8A2B-CEC18A8F59DD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {EBBDAF9A-BFC7-4BDC-8C51-0501B59A1DDC} = {2156FB93-C252-4B33-8A0C-73C82FABB163} @@ -76,5 +82,6 @@ Global {624E7B11-8A18-46E5-AB1F-6AF6097F9D4D} = {2156FB93-C252-4B33-8A0C-73C82FABB163} {A3ADC9AF-39B7-4EC4-8022-946118A8C322} = {624E7B11-8A18-46E5-AB1F-6AF6097F9D4D} {2DF9FEEF-5A60-4B41-9B5F-F883DCE33EF4} = {2156FB93-C252-4B33-8A0C-73C82FABB163} + {F1F3F60B-911F-4036-8A2B-CEC18A8F59DD} = {624E7B11-8A18-46E5-AB1F-6AF6097F9D4D} EndGlobalSection EndGlobal diff --git a/DotBased/Result.cs b/DotBased/Result.cs index 49e8ba6..e188b77 100755 --- a/DotBased/Result.cs +++ b/DotBased/Result.cs @@ -47,7 +47,7 @@ public class Result : Result public class ListResult : Result { - public ListResult(bool success, string message, int totalCount, IEnumerable? items, Exception? exception) : base(success, message, exception) + public ListResult(bool success, string message, int totalCount, IEnumerable? items, int limit = -1, int offset = -1, Exception? exception = null) : base(success, message, exception) { Items = items != null ? new List(items) : new List(); TotalCount = totalCount; @@ -69,9 +69,19 @@ public class ListResult : Result /// public int TotalCount { get; } + /// + /// The limit this result contains + /// + public int Limit { get; } + + /// + /// The offset this result has the items from. + /// + public int Offset { get; } + public static ListResult Ok(IEnumerable items, int totalCount = -1) => - new(true, string.Empty, totalCount, items, null); + new(true, string.Empty, totalCount, items); public new static ListResult Failed(string message, Exception? exception = null) => - new(false, message, -1, null, exception); + new(false, message, -1, null); } \ No newline at end of file