[CHANGE] Repository manager

This commit is contained in:
max 2024-12-30 15:40:52 +01:00
parent 172d5838e7
commit 2d96a25906
4 changed files with 19 additions and 6 deletions

View File

@ -2,6 +2,6 @@ namespace DotBased.AspNet.Authority.Repositories;
public interface IAuthorityRepository
{
public Task<int> GetVersion();
public Task SetVersion(int version);
public Task<long> GetVersion();
public Task SetVersion(long version);
}

View File

@ -1,6 +1,6 @@
namespace DotBased.AspNet.Authority.Repositories;
public interface IGroupRepository<TGroup, TId> where TGroup : class where TId : IEquatable<TId>
public interface IGroupRepository<TGroup> where TGroup : class
{
}

View File

@ -0,0 +1,13 @@
namespace DotBased.AspNet.Authority.Repositories;
public class RepositoryManager<TUser, TGroup> where TUser : class where TGroup : class
{
public RepositoryManager(IUserRepository<TUser> userRepository, IGroupRepository<TGroup> groupRepository)
{
UserRepository = userRepository;
GroupRepository = groupRepository;
}
public IUserRepository<TUser> UserRepository { get; set; }
public IGroupRepository<TGroup> GroupRepository { get; set; }
}

View File

@ -83,11 +83,11 @@ public class AuthorityManager
_logger.Debug("{HandledPropCount}/{TotalPropCount} protection properties handled!", handledProperties, props.Count);
}
public bool IsPropertieProtected<TModel>(string propertieName)
public bool IsPropertyProtected<TModel>(string propertyName)
{
var protectedProperties = GetProtectedProperties<TModel>();
var propertieFound = protectedProperties.Where(propInfo => propInfo.Name == propertieName);
return propertieFound.Any();
var propertyFound = protectedProperties.Where(propInfo => propInfo.Name == propertyName);
return propertyFound.Any();
}
public List<PropertyInfo> GetProtectedPropertiesValues<TModel>(TModel model)