Deprecate services and update mapping profiles
- Added obsolete attributes to `AuthController`, `ModuleController`, and various mapping profiles, recommending the use of MediatR and DigitalData.Core.Exceptions. - Updated `User` class to use `required` keyword for `DateFormat` in .NET 7.0 or greater. - Marked methods in `Extensions` and `AddUserManagerInfrastructure` as obsolete, suggesting the use of IRepository. - Adjusted import statements in `DependencyInjection.cs` and marked `GroupOfUserRepository` and `ModuleRepository` as obsolete, recommending a Repository pattern.
This commit is contained in:
parent
39a9181257
commit
3de7e64f85
@ -13,6 +13,7 @@ namespace DigitalData.UserManager.API.Controllers;
|
||||
[ApiController]
|
||||
public class AuthController : ControllerBase
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly ILogger<UserController> _logger;
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IUserService _userService;
|
||||
|
||||
@ -7,8 +7,10 @@ using Microsoft.AspNetCore.Authorization;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class ModuleController : ReadControllerBaseWithErrorHandling<IModuleService, ModuleDto, Module, int>
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public ModuleController(ILogger<ModuleController> logger, IModuleService service) : base(logger, service)
|
||||
{
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class GroupMappingProfile : Profile
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public GroupMappingProfile()
|
||||
{
|
||||
CreateMap<Group, GroupCreateDto>();
|
||||
|
||||
@ -6,6 +6,7 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class GroupOfUserMappingProfile : Profile
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public GroupOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<GroupOfUser, GroupOfUserCreateDto>();
|
||||
@ -17,4 +18,4 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
CreateMap<GroupOfUserUpdateDto, GroupOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class UserRepMappingProfile : Profile
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public UserRepMappingProfile()
|
||||
{
|
||||
CreateMap<UserRep, UserRepCreateDto>();
|
||||
|
||||
@ -8,6 +8,7 @@ namespace DigitalData.UserManager.DependencyInjection;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
[Obsolete("Use IRepository")]
|
||||
public static IServiceCollection AddUserManager<TDbContext>(this IServiceCollection services)
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
@ -16,10 +17,11 @@ public static class Extensions
|
||||
return services;
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public static IServiceCollection AddUserManager(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction)
|
||||
{
|
||||
services.AddUserManagerInfrastructure(optionsAction);
|
||||
services.AddUserManagerApplication();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,7 +74,11 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Column("DATE_FORMAT")]
|
||||
[StringLength(10)]
|
||||
[DefaultValue("dd.MM.yyyy")]
|
||||
public string DateFormat { get; set; }
|
||||
public
|
||||
#if NET7_0_OR_GREATER
|
||||
required
|
||||
#endif
|
||||
string DateFormat { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("ACTIVE")]
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using DigitalData.UserManager.Application;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -37,7 +36,8 @@ public static class DependencyInjection
|
||||
/// <param name="services">The <see cref="IServiceCollection"/> to which the services will be added.</param>
|
||||
/// <param name="optionsAction">An <see cref="Action{T}"/> to configure the <see cref="DbContextOptionsBuilder"/>.</param>
|
||||
/// <returns>The updated <see cref="IServiceCollection"/>.</returns>
|
||||
[Obsolete("Use IRepository")]
|
||||
public static IServiceCollection AddUserManagerInfrastructure(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction) => services
|
||||
.AddDbContext<UserManagerDbContext>(optionsAction)
|
||||
.AddUserManagerInfrastructure<UserManagerDbContext>();
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
[Obsolete("Use Repository")]
|
||||
public class GroupOfUserRepository<TDbContext> : CRUDRepository<GroupOfUser, int, TDbContext>, IGroupOfUserRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use Repository")]
|
||||
public class ModuleRepository<TDbContext> : CRUDRepository<Module, int, TDbContext>, IModuleRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user