вводим проект с моделями

This commit is contained in:
kotcheshir73 2022-03-18 12:47:34 +04:00
parent c4402d976d
commit 9b066d5c25
36 changed files with 235 additions and 98 deletions

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ModuleTools\ModuleTools.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,27 @@
using CoreModels.Tools;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using System;
namespace CoreModels.ModelsSecurity
{
[EntityDescription("Access", "Доступные действия для ролей")]
[EntityDependency("Role", "RoleId", "Доступные дейсвтиия создаются под конкретную роль")]
public interface IAccessModel : IId
{
/// <summary>
/// Илентификатор роли
/// </summary>
Guid RoleId { get; }
/// <summary>
/// Тип операции
/// </summary>
AccessOperation AccessOperation { get; }
/// <summary>
/// Режим доступа
/// </summary>
AccessType AccessType { get; }
}
}

View File

@ -0,0 +1,27 @@
using CoreModels.Tools;
using ModuleTools.Attributes;
namespace CoreModels.ModelsSecurity
{
/// <summary>
/// Модель, описывающиая общие настройки системы
/// </summary>
[EntityDescription("EnviromentSetting", "Общие настройки системы")]
public interface IEnviromentSettingModel : IId
{
/// <summary>
/// Ключ настройки
/// </summary>
string Key { get; }
/// <summary>
/// Значение настройки
/// </summary>
string Value { get; }
/// <summary>
/// Описание настройки
/// </summary>
string Description { get; }
}
}

View File

@ -0,0 +1,16 @@
using CoreModels.Tools;
using ModuleTools.Attributes;
namespace CoreModels.ModelsSecurity
{
/// <summary>
/// Модель, описывающиая роль в системе
/// </summary>
[EntityDescription("Role", "Роли в системе")]
public interface IRoleModel : IId
{
string RoleName { get; }
int RolePriority { get; }
}
}

View File

@ -0,0 +1,27 @@
using CoreModels.Tools;
using ModuleTools.Attributes;
using System;
namespace CoreModels.ModelsSecurity
{
/// <summary>
/// Модель, описывающиая пользователя системы
/// </summary>
[EntityDescription("User", "Пользователи системы")]
public interface IUserModel : IId
{
string UserName { get; }
string PasswordHash { get; }
byte[] Avatar { get; }
DateTime? DateLastVisit { get; }
bool IsBanned { get; }
DateTime? DateBanned { get; }
int CountAttempt { get; }
}
}

View File

@ -0,0 +1,19 @@
using CoreModels.Tools;
using ModuleTools.Attributes;
using System;
namespace CoreModels.ModelsSecurity
{
/// <summary>
/// Связка пользователь - роль
/// </summary>
[EntityDescription("UserRole", "Связь пользователей системы с ролями, которые им назначены")]
[EntityDependency("Role", "RoleId", "К какой роли относится пользователь")]
[EntityDependency("User", "UserId", "К какой роли относится пользователь")]
public interface IUserRoleModel : IId
{
Guid RoleId { get; }
Guid UserId { get; }
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace CoreModels.Tools
{
public interface IId
{
Guid Id { get; }
}
}

View File

@ -14,6 +14,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CoreModels\CoreModels.csproj" />
<ProjectReference Include="..\ModuleTools\ModuleTools.csproj" />
</ItemGroup>

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.Interfaces;
using System;
@ -7,13 +8,8 @@ using System.Runtime.Serialization;
namespace DatabaseCore.Models.Security
{
/// <summary>
/// Класс, описывающий возможные действия для роли
/// </summary>
[DataContract]
[EntityDescription("Access", "Доступные действия для ролей")]
[EntityDependency("Role", "RoleId", "Доступные дейсвтиия создаются под конкретную роль")]
public class Access : BaseEntity, IEntitySecurityExtenstion<Access>
public class Access : BaseEntity, IEntitySecurityExtenstion<Access>, IAccessModel
{
[DataMember]
[Required]
@ -47,6 +43,6 @@ namespace DatabaseCore.Models.Security
return entity;
}
public override string ToString() => $"{Role.RoleName}-{AccessOperation.ToString("G")}({AccessType.ToString("G")})";
public override string ToString() => $"{Role.RoleName}-{AccessOperation:G}({AccessType:G})";
}
}

View File

@ -1,16 +1,13 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Security
{
/// <summary>
/// Класс, описывающий общие настройки системы
/// </summary>
[DataContract]
[EntityDescription("EnviromentSetting", "Общие настройки системы")]
public class EnviromentSetting : BaseEntity, IEntitySecurityExtenstion<EnviromentSetting>
public class EnviromentSetting : BaseEntity, IEntitySecurityExtenstion<EnviromentSetting>, IEnviromentSettingModel
{
[DataMember]
[Required]

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@ -7,12 +8,8 @@ using System.Runtime.Serialization;
namespace DatabaseCore.Models.Security
{
/// <summary>
/// Класс, описывающий роль в системе
/// </summary>
[DataContract]
[EntityDescription("Role", "Роли в системе")]
public class Role : BaseEntity, IEntitySecurityExtenstion<Role>
public class Role : BaseEntity, IEntitySecurityExtenstion<Role>, IRoleModel
{
[DataMember]
[Required]

View File

@ -1,4 +1,5 @@
using DatabaseCore.Models.Department;
using CoreModels.ModelsSecurity;
using DatabaseCore.Models.Department;
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
@ -9,21 +10,17 @@ using System.Runtime.Serialization;
namespace DatabaseCore.Models.Security
{
/// <summary>
/// Класс, описывающий пользователя системы
/// </summary>
[DataContract]
[EntityDescription("User", "Пользователи системы")]
public class User : BaseEntity, IEntitySecurityExtenstion<User>
public class User : BaseEntity, IEntitySecurityExtenstion<User>, IUserModel
{
[DataMember]
[Required]
[MapConfiguration("Login")]
[MapConfiguration("UserName")]
public string UserName { get; set; }
[DataMember]
[Required]
[MapConfiguration("Password")]
[MapConfiguration("PasswordHash")]
public string PasswordHash { get; set; }
[DataMember]

View File

@ -1,18 +1,13 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Security
{
/// <summary>
/// Связка пользователь - роль
/// </summary>
[DataContract]
[EntityDescription("UserRole", "Связь пользователей системы с ролями, которые им назначены")]
[EntityDependency("Role", "RoleId", "К какой роли относится пользователь")]
[EntityDependency("User", "UserId", "К какой роли относится пользователь")]
public class UserRole : BaseEntity, IEntitySecurityExtenstion<UserRole>
public class UserRole : BaseEntity, IEntitySecurityExtenstion<UserRole>, IUserRoleModel
{
[DataMember]
[MapConfiguration("RoleId")]

View File

@ -6,7 +6,7 @@ namespace ModuleTools.Attributes
/// Оописание зависимости сущности от другой сущности (требуется для выстраивания последоватльности сохранения и загрузки данных,
/// применяется к классам-описывающим сущности в хранилище)
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
public class EntityDependencyAttribute : Attribute
{
/// <summary>

View File

@ -6,7 +6,7 @@ namespace ModuleTools.Attributes
/// Оописание класса из базы данных, его назначение (требуется для выстраивания иерархии с описанием классов,
/// применяется к классам-описывающим сущности в хранилище)
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class EntityDescriptionAttribute : Attribute
{
/// <summary>

View File

@ -68,8 +68,8 @@ namespace DepartmentWindowsDesktop.EntityControls
{
var newuser = logic.Create(new UserSetBindingModel
{
Login = userName,
Password = model.DateBirth.ToShortDateString(),
UserName = userName,
PasswordHash = model.DateBirth.ToShortDateString(),
Avatar = model.Photo
});
if (newuser == null)
@ -107,7 +107,7 @@ namespace DepartmentWindowsDesktop.EntityControls
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");
return;
}
user.Password = model.DateBirth.ToShortDateString();
user.PasswordHash = model.DateBirth.ToShortDateString();
user = logic.Update(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
if (user == null)
{

View File

@ -68,8 +68,8 @@ namespace DepartmentWindowsDesktop.EntityControls
{
var newuser = logic.Create(new UserSetBindingModel
{
Login = userName,
Password = model.DateBirth.ToShortDateString(),
UserName = userName,
PasswordHash = model.DateBirth.ToShortDateString(),
Avatar = model.Photo
});
if (newuser == null)
@ -107,7 +107,7 @@ namespace DepartmentWindowsDesktop.EntityControls
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");
return;
}
user.Password = model.DateBirth.ToShortDateString();
user.PasswordHash = model.DateBirth.ToShortDateString();
user = logic.Update(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
if (user == null)
{

View File

@ -62,8 +62,8 @@ namespace DepartmentWindowsDesktop.EntityControls
}
user = logic.Create(new UserSetBindingModel
{
Login = model.NumberOfBook,
Password = userName,
UserName = model.NumberOfBook,
PasswordHash = userName,
Avatar = model.Photo
});
if (user == null)
@ -100,7 +100,7 @@ namespace DepartmentWindowsDesktop.EntityControls
DialogHelper.MessageException(logic.Errors, "Ошибка при получении пользователя");
return;
}
user.Password = model.NumberOfBook;
user.PasswordHash = model.NumberOfBook;
user = logic.Update(Mapper.MapToClass<UserViewModel, UserSetBindingModel>(user, true));
if (user == null)
{

View File

@ -23,11 +23,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModuleTools", "Common\Modul
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Department", "Department", "{A19E7709-6AD8-4E9B-B3AB-4339C67D9F39}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DepartmentBusinessLogic", "Department\DepartmentBusinessLogic\DepartmentBusinessLogic.csproj", "{69B94DB1-D1BE-4905-81AC-A5D49D0C9719}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepartmentBusinessLogic", "Department\DepartmentBusinessLogic\DepartmentBusinessLogic.csproj", "{69B94DB1-D1BE-4905-81AC-A5D49D0C9719}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DepartmentDatabaseImplementation", "Department\DepartmentDatabaseImplementation.csproj\DepartmentDatabaseImplementation.csproj", "{1A9E20FE-6324-4839-A3AD-5726305122A5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepartmentDatabaseImplementation", "Department\DepartmentDatabaseImplementation.csproj\DepartmentDatabaseImplementation.csproj", "{1A9E20FE-6324-4839-A3AD-5726305122A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DepartmentWindowsDesktop", "Department\DepartmentWindowsDesktop\DepartmentWindowsDesktop.csproj", "{8E12DE14-0D83-48D8-964D-8B2BB06DB129}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepartmentWindowsDesktop", "Department\DepartmentWindowsDesktop\DepartmentWindowsDesktop.csproj", "{8E12DE14-0D83-48D8-964D-8B2BB06DB129}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreModels", "Common\CoreModels\CoreModels.csproj", "{FDF81413-ABAD-4890-A60F-4FEC62DD2A7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -75,6 +77,10 @@ Global
{8E12DE14-0D83-48D8-964D-8B2BB06DB129}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E12DE14-0D83-48D8-964D-8B2BB06DB129}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E12DE14-0D83-48D8-964D-8B2BB06DB129}.Release|Any CPU.Build.0 = Release|Any CPU
{FDF81413-ABAD-4890-A60F-4FEC62DD2A7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDF81413-ABAD-4890-A60F-4FEC62DD2A7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDF81413-ABAD-4890-A60F-4FEC62DD2A7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDF81413-ABAD-4890-A60F-4FEC62DD2A7D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -89,6 +95,7 @@ Global
{69B94DB1-D1BE-4905-81AC-A5D49D0C9719} = {A19E7709-6AD8-4E9B-B3AB-4339C67D9F39}
{1A9E20FE-6324-4839-A3AD-5726305122A5} = {A19E7709-6AD8-4E9B-B3AB-4339C67D9F39}
{8E12DE14-0D83-48D8-964D-8B2BB06DB129} = {A19E7709-6AD8-4E9B-B3AB-4339C67D9F39}
{FDF81413-ABAD-4890-A60F-4FEC62DD2A7D} = {6F154F8D-3437-45EE-9D89-02B96BDF3E8E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FBA0CB49-EF2D-4538-9D00-FCEDA24879A9}

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using ModuleTools.Enums;
using System;
@ -20,7 +21,7 @@ namespace SecurityBusinessLogic.BindingModels
/// <summary>
/// Сохранение информации по доступу
/// </summary>
public class AccessSetBindingModel : SetBindingModel
public class AccessSetBindingModel : SetBindingModel, IAccessModel
{
[MapConfiguration("RoleId")]
public Guid RoleId { get; set; }

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System.ComponentModel.DataAnnotations;
@ -15,7 +16,7 @@ namespace SecurityBusinessLogic.BindingModels
/// <summary>
/// Сохранение общих настроек системы
/// </summary>
public class EnviromentSettingSetBindingModel : SetBindingModel
public class EnviromentSettingSetBindingModel : SetBindingModel, IEnviromentSettingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("Key")]

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System.ComponentModel.DataAnnotations;
@ -12,7 +13,7 @@ namespace SecurityBusinessLogic.BindingModels
/// <summary>
/// Сохранение роли
/// </summary>
public class RoleSetBindingModel : SetBindingModel
public class RoleSetBindingModel : SetBindingModel, IRoleModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("RoleName")]

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
@ -18,15 +19,15 @@ namespace SecurityBusinessLogic.BindingModels
/// <summary>
/// Сохранение пользователя
/// </summary>
public class UserSetBindingModel : SetBindingModel
public class UserSetBindingModel : SetBindingModel, IUserModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("Login")]
public string Login { get; set; }
[MapConfiguration("UserName")]
public string UserName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Password")]
public string Password { get; set; }
public string PasswordHash { get; set; }
[MapConfiguration("Avatar")]
public byte[] Avatar { get; set; }

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
@ -18,7 +19,7 @@ namespace SecurityBusinessLogic.BindingModels
/// <summary>
/// Сохранение связи пользователя с ролью
/// </summary>
public class UserRoleSetBindingModel : SetBindingModel
public class UserRoleSetBindingModel : SetBindingModel, IUserRoleModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("UserId")]

View File

@ -39,8 +39,8 @@ namespace SecurityBusinessLogic.BusinessLogics
{
result = Service.Create(new UserSetBindingModel
{
Login = model.Login,
Password = password
UserName = model.Login,
PasswordHash = password
});
}
if (!result.IsSucceeded)

View File

@ -9,6 +9,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\CoreModels\CoreModels.csproj" />
<ProjectReference Include="..\..\Common\ModuleTools\ModuleTools.csproj" />
</ItemGroup>

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
using System;
@ -14,7 +15,7 @@ namespace SecurityBusinessLogic.ViewModels
/// Элемент доступа
/// </summary>
[ViewModelControlElementClass()]
public class AccessViewModel : ElementViewModel
public class AccessViewModel : ElementViewModel, IAccessModel
{
[ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = true, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")]
[MapConfiguration("RoleId", AllowCopyWithoutRigth = false)]

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
@ -13,7 +14,7 @@ namespace SecurityBusinessLogic.ViewModels
/// Элемент общих настроек системы
/// </summary>
[ViewModelControlElementClass()]
public class EnviromentSettingViewModel : ElementViewModel
public class EnviromentSettingViewModel : ElementViewModel, IEnviromentSettingModel
{
[ViewModelControlListProperty("Ключ")]
[ViewModelControlElementProperty("Ключ", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)]

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
@ -17,7 +18,7 @@ namespace SecurityBusinessLogic.ViewModels
ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlAccessList, SecurityWindowsDesktop")]
[ViewModelControlElementDependenceEntity(Title = "Пользователи", Order = 2, ParentPropertyName = "RoleId",
ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserRoleList, SecurityWindowsDesktop")]
public class RoleViewModel : ElementViewModel
public class RoleViewModel : ElementViewModel, IRoleModel
{
[ViewModelControlListProperty("Название роли")]
[ViewModelControlElementProperty("Название роли", ControlType.ControlString, MustHaveValue = true)]

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
using System;
@ -14,7 +15,7 @@ namespace SecurityBusinessLogic.ViewModels
/// Элемент пользователей
/// </summary>
[ViewModelControlElementClass()]
public class UserRoleViewModel : ElementViewModel
public class UserRoleViewModel : ElementViewModel, IUserRoleModel
{
[ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")]
[MapConfiguration("UserId", AllowCopyWithoutRigth = false)]

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.ModelsSecurity;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
using System;
@ -16,15 +17,15 @@ namespace SecurityBusinessLogic.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 400)]
[ViewModelControlElementDependenceEntity(Title = "Роли", Order = 1, ParentPropertyName = "UserId",
ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserRoleList, SecurityWindowsDesktop")]
public class UserViewModel : ElementViewModel
public class UserViewModel : ElementViewModel, IUserModel
{
[ViewModelControlListProperty("Пользователь")]
[ViewModelControlElementProperty("Логин", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("UserName")]
public string Login { get; set; }
public string UserName { get; set; }
[MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)]
public string Password { get; set; }
public string PasswordHash { get; set; }
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)]
[MapConfiguration("Avatar")]

View File

@ -22,11 +22,11 @@ namespace SecurityDatabaseImplementation.Implementations
{
protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, UserSetBindingModel model)
{
if (model.Password.IsEmpty())
if (model.PasswordHash.IsEmpty())
{
model.Password = "qwerty";
model.PasswordHash = "qwerty";
}
model.Password = SecurityManager.GetPasswordHash(model.Password);
model.PasswordHash = SecurityManager.GetPasswordHash(model.PasswordHash);
return OperationResultModel.Success(null);
}
@ -69,7 +69,7 @@ namespace SecurityDatabaseImplementation.Implementations
context.SaveChanges();
}
protected override User GetUniqueEntity(UserSetBindingModel model, DbContext context) => context.Set<User>().FirstOrDefault(x => x.UserName == model.Login && x.Id != model.Id);
protected override User GetUniqueEntity(UserSetBindingModel model, DbContext context) => context.Set<User>().FirstOrDefault((System.Linq.Expressions.Expression<Func<User, bool>>)(x => x.UserName == model.UserName && x.Id != model.Id));
protected override IQueryable<User> IncludingWhenReading(IQueryable<User> query) => query;