Compare commits
5 Commits
d2dc116cd0
...
eb92b4db67
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb92b4db67 | ||
|
|
98362c46b5 | ||
|
|
2ce69e3b3a | ||
|
|
43c98f9454 | ||
|
|
8faed31baa |
@@ -5,6 +5,7 @@ using DigitalData.Core.Application;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using NLog.Web;
|
||||
using NLog;
|
||||
using DigitalData.Core.API;
|
||||
|
||||
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||
logger.Debug("init main");
|
||||
@@ -38,7 +39,7 @@ try {
|
||||
options.LogoutPath = "/api/auth/logout";
|
||||
});
|
||||
|
||||
builder.Services.AddDbContext<DDECMDbContext>(options =>
|
||||
builder.Services.AddDbContext<UserManagerDbContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DD_ECM_Connection"))
|
||||
.EnableDetailedErrors());
|
||||
|
||||
@@ -57,10 +58,13 @@ try {
|
||||
});
|
||||
|
||||
//builder.Services.AddAutoMapper(typeof(DirectoryMappingProfile).Assembly);
|
||||
builder.Services.AddUserManager();
|
||||
builder.Services.AddUserManager<UserManagerDbContext>();
|
||||
|
||||
builder.ConfigureBySection<DirectorySearchOptions>();
|
||||
builder.Services.AddDirectorySearchService();
|
||||
|
||||
builder.Services.AddCookieBasedLocalizer();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseCors("DefaultCorsPolicy");
|
||||
@@ -71,6 +75,8 @@ try {
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseCookieBasedLocalizer("de-DE", "en-US");
|
||||
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
"AllowedOrigins": [ "http://172.24.12.39:85", "http://localhost:85", "http://localhost:4200", "http://localhost:5500", "https://localhost:7202" ],
|
||||
"UseSwagger": true,
|
||||
"RunAsWindowsService": false,
|
||||
"DirectorySearch": {
|
||||
"DirectorySearchOptions": {
|
||||
"ServerName": "DD-VMP01-DC01",
|
||||
"Root": "DC=dd-gan,DC=local,DC=digitaldata,DC=works",
|
||||
"Root": "DC=dd-gan,DC=local,DC=digitaldata,DC=works",
|
||||
"UserCacheExpirationDays": 1,
|
||||
"CustomSearchFilters": {
|
||||
"User": "(&(objectClass=user)(sAMAccountName=*))",
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
"AllowedOrigins": [ "http://172.24.12.39:85", "http://localhost:85", "http://localhost:4200", "http://localhost:5500", "https://localhost:7202" ],
|
||||
"UseSwagger": true,
|
||||
"RunAsWindowsService": false,
|
||||
"DirectorySearch": {
|
||||
"DirectorySearchOptions": {
|
||||
"ServerName": "DD-VMP01-DC01",
|
||||
"Root": "DC=dd-gan,DC=local,DC=digitaldata,DC=works",
|
||||
"Root": "DC=dd-gan,DC=local,DC=digitaldata,DC=works",
|
||||
"UserCacheExpirationDays": 1,
|
||||
"CustomSearchFilters": {
|
||||
"User": "(&(objectClass=user)(sAMAccountName=*))",
|
||||
|
||||
@@ -3,6 +3,7 @@ using DigitalData.UserManager.Application.MappingProfiles;
|
||||
using DigitalData.UserManager.Application.Services;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DigitalData.UserManager.Application
|
||||
@@ -10,14 +11,15 @@ namespace DigitalData.UserManager.Application
|
||||
public static class DIExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension method to configure dependency injection for the UserManager application.
|
||||
/// Adds the UserManager services and repositories to the specified <see cref="IServiceCollection"/>.
|
||||
/// This method registers the necessary mappings, repositories, and services for the UserManager.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method registers AutoMapper profiles, repositories, and services for the UserManager application.
|
||||
/// </remarks>
|
||||
/// <param name="services">The IServiceCollection to add services to.</param>
|
||||
/// <typeparam name="TDbContext">The type of the DbContext to use for the repositories.</typeparam>
|
||||
/// <param name="services">The IServiceCollection to which the services will be added.</param>
|
||||
/// <returns>The updated IServiceCollection.</returns>
|
||||
public static IServiceCollection AddUserManager(this IServiceCollection services) => services
|
||||
public static IServiceCollection AddUserManager<TDbContext>(this IServiceCollection services)
|
||||
where TDbContext : DbContext
|
||||
=> services
|
||||
.AddAutoMapper(typeof(UserMappingProfile).Assembly)
|
||||
.AddAutoMapper(typeof(GroupMappingProfile).Assembly)
|
||||
.AddAutoMapper(typeof(GroupOfUserMappingProfile).Assembly)
|
||||
@@ -25,12 +27,12 @@ namespace DigitalData.UserManager.Application
|
||||
.AddAutoMapper(typeof(ModuleOfUserMappingProfile).Assembly)
|
||||
.AddAutoMapper(typeof(UserRepMappingProfile).Assembly)
|
||||
|
||||
.AddScoped<IUserRepository, UserRepository>()
|
||||
.AddScoped<IGroupRepository, GroupRepository>()
|
||||
.AddScoped<IGroupOfUserRepository, GroupOfUserRepository>()
|
||||
.AddScoped<IModuleRepository, ModuleRepository>()
|
||||
.AddScoped<IModuleOfUserRepository, ModuleOfUserRepository>()
|
||||
.AddScoped<IUserRepRepository, UserRepRepository>()
|
||||
.AddScoped<IUserRepository, UserRepository<TDbContext>>()
|
||||
.AddScoped<IGroupRepository, GroupRepository<TDbContext>>()
|
||||
.AddScoped<IGroupOfUserRepository, GroupOfUserRepository<TDbContext>>()
|
||||
.AddScoped<IModuleRepository, ModuleRepository<TDbContext>>()
|
||||
.AddScoped<IModuleOfUserRepository, ModuleOfUserRepository<TDbContext>>()
|
||||
.AddScoped<IUserRepRepository, UserRepRepository<TDbContext>>()
|
||||
|
||||
.AddScoped<IUserService, UserService>()
|
||||
.AddScoped<IGroupService, GroupService>()
|
||||
|
||||
101
DigitalData.UserManager.Application/Resource.de-DE.resx
Normal file
101
DigitalData.UserManager.Application/Resource.de-DE.resx
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
101
DigitalData.UserManager.Application/Resource.en-US.resx
Normal file
101
DigitalData.UserManager.Application/Resource.en-US.resx
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -11,7 +11,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class GroupOfUserService : CRUDService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>, IGroupOfUserService
|
||||
{
|
||||
public GroupOfUserService(IGroupOfUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
public GroupOfUserService(IGroupOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class GroupService : CRUDService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>, IGroupService
|
||||
{
|
||||
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
private readonly IStringLocalizer<Resource> _localizer;
|
||||
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
public async Task<DataResult<int>> CreateAsync(DirectoryGroupDto adGroup)
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class ModuleOfUserService : CRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>, IModuleOfUserService
|
||||
{
|
||||
public ModuleOfUserService(IModuleOfUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
public ModuleOfUserService(IModuleOfUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class ModuleService : BasicCRUDService<IModuleRepository, ModuleDto, Module, int>, IModuleService
|
||||
{
|
||||
public ModuleService(IModuleRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
public ModuleService(IModuleRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class UserRepService : CRUDService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>, IUserRepService
|
||||
{
|
||||
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
public class UserService : CRUDService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User, int>, IUserService
|
||||
{
|
||||
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
private readonly IStringLocalizer<Resource> _localizer;
|
||||
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
public async Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId)
|
||||
|
||||
@@ -1,39 +1,35 @@
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class DDECMDbContext : DbContext
|
||||
{
|
||||
public DDECMDbContext(DbContextOptions<DDECMDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<User>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_INS"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD_LOG"));
|
||||
|
||||
modelBuilder.Entity<GroupOfUser>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<Group>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_AFT_UPD"))
|
||||
.HasKey(group => group.Guid);
|
||||
|
||||
modelBuilder.Entity<Module>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_MODULE_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<ModuleOfUser>();
|
||||
|
||||
modelBuilder.Entity<UserRep>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_REPRESENTATION_AFT_UPD"));
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure
|
||||
{
|
||||
public static class DbContextExtensions
|
||||
{
|
||||
public static ModelBuilder ConfigureUserManager(this ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<User>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_INS"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_AFT_UPD_LOG"));
|
||||
|
||||
modelBuilder.Entity<GroupOfUser>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_DEL"))
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_USER_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<Group>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_AFT_UPD"))
|
||||
.HasKey(group => group.Guid);
|
||||
|
||||
modelBuilder.Entity<Module>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_MODULE_AFT_UPD"));
|
||||
|
||||
modelBuilder.Entity<ModuleOfUser>();
|
||||
|
||||
modelBuilder.Entity<UserRep>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_USER_REPRESENTATION_AFT_UPD"));
|
||||
|
||||
return modelBuilder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class GroupOfUserRepository : CRUDRepository<GroupOfUser, int, DDECMDbContext>, IGroupOfUserRepository
|
||||
public class GroupOfUserRepository<TDbContext> : CRUDRepository<GroupOfUser, int, TDbContext>, IGroupOfUserRepository
|
||||
where TDbContext : DbContext
|
||||
{
|
||||
public GroupOfUserRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public GroupOfUserRepository(TDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class GroupRepository : CRUDRepository<Group, int, DDECMDbContext>, IGroupRepository
|
||||
public class GroupRepository<TDbContext> : CRUDRepository<Group, int, TDbContext>, IGroupRepository
|
||||
where TDbContext : DbContext
|
||||
{
|
||||
public GroupRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public GroupRepository(TDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class ModuleOfUserRepository : CRUDRepository<ModuleOfUser, int, DDECMDbContext>, IModuleOfUserRepository
|
||||
public class ModuleOfUserRepository<TDbContext> : CRUDRepository<ModuleOfUser, int, TDbContext>, IModuleOfUserRepository
|
||||
where TDbContext : DbContext
|
||||
{
|
||||
public ModuleOfUserRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public ModuleOfUserRepository(TDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class ModuleRepository : CRUDRepository<Module, int, DDECMDbContext>, IModuleRepository
|
||||
public class ModuleRepository<TDbContext> : CRUDRepository<Module, int, TDbContext>, IModuleRepository
|
||||
where TDbContext : DbContext
|
||||
{
|
||||
public ModuleRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public ModuleRepository(TDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserRepRepository : CRUDRepository<UserRep, int, DDECMDbContext>, IUserRepRepository
|
||||
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
||||
where TDbContext : DbContext
|
||||
{
|
||||
public UserRepRepository(DDECMDbContext dbContext) : base(dbContext)
|
||||
public UserRepRepository(TDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserRepository : CRUDRepository<User, int, DDECMDbContext>, IUserRepository
|
||||
public class UserRepository<TDbContext> : CRUDRepository<User, int, TDbContext>, IUserRepository
|
||||
where TDbContext : DbContext
|
||||
{
|
||||
private IModuleOfUserRepository _moduleOfUserRepo;
|
||||
private IGroupOfUserRepository _groupOfUserRepo;
|
||||
public UserRepository(DDECMDbContext dbContext, IModuleOfUserRepository moduleOfUserRepo, IGroupOfUserRepository groupOfUserRepo) : base(dbContext)
|
||||
public UserRepository(TDbContext dbContext, IModuleOfUserRepository moduleOfUserRepo, IGroupOfUserRepository groupOfUserRepo) : base(dbContext)
|
||||
{
|
||||
_moduleOfUserRepo = moduleOfUserRepo;
|
||||
_groupOfUserRepo = groupOfUserRepo;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
public class UserManagerDbContext : DbContext
|
||||
{
|
||||
public UserManagerDbContext(DbContextOptions<UserManagerDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ConfigureUserManager();
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user