Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
HIAST-Clinics
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
almohanad.hafez
HIAST-Clinics
Commits
00408ab3
Commit
00408ab3
authored
Aug 20, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(B) Add identity classes, link them to DB
parent
1c65ec94
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1641 additions
and
0 deletions
+1641
-0
Role.cs
Clinics.Backend/Domain/Entities/Identity/UserRoles/Role.cs
+32
-0
Roles.cs
Clinics.Backend/Domain/Entities/Identity/UserRoles/Roles.cs
+21
-0
DoctorUser.cs
Clinics.Backend/Domain/Entities/Identity/Users/DoctorUser.cs
+49
-0
ReceptionistUser.cs
...ackend/Domain/Entities/Identity/Users/ReceptionistUser.cs
+50
-0
User.cs
Clinics.Backend/Domain/Entities/Identity/Users/User.cs
+52
-0
IdentityErrors.cs
Clinics.Backend/Domain/Errors/IdentityErrors.cs
+8
-0
RoleConfiguration.cs
...stence/Configurations/Identity/Roles/RoleConfiguration.cs
+19
-0
DoctorUserConfiguration.cs
.../Configurations/Identity/Users/DoctorUserConfiguration.cs
+25
-0
ReceptionistUserConfiguration.cs
...gurations/Identity/Users/ReceptionistUserConfiguration.cs
+25
-0
UserConfiguration.cs
...stence/Configurations/Identity/Users/UserConfiguration.cs
+20
-0
20240820202107_Add_Identity.Designer.cs
...stence/Migrations/20240820202107_Add_Identity.Designer.cs
+1070
-0
20240820202107_Add_Identity.cs
...end/Persistence/Migrations/20240820202107_Add_Identity.cs
+137
-0
ClinicsDbContextModelSnapshot.cs
...d/Persistence/Migrations/ClinicsDbContextModelSnapshot.cs
+133
-0
No files found.
Clinics.Backend/Domain/Entities/Identity/UserRoles/Role.cs
0 → 100644
View file @
00408ab3
using
Domain.Primitives
;
namespace
Domain.Entities.Identity.UserRoles
;
public
sealed
class
Role
:
Entity
{
#
region
Private
ctor
private
Role
(
int
id
)
:
base
(
id
)
{
}
private
Role
(
int
id
,
string
name
)
:
base
(
id
)
{
Name
=
name
;
}
#
endregion
#
region
Properties
public
string
Name
{
get
;
private
set
;
}
=
null
!;
#
endregion
#
region
Methods
#
region
Static
factory
internal
static
Role
Create
(
int
id
,
string
name
)
{
return
new
Role
(
id
,
name
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/Identity/UserRoles/Roles.cs
0 → 100644
View file @
00408ab3
namespace
Domain.Entities.Identity.UserRoles
;
public
static
class
Roles
{
#
region
Constant
values
public
static
int
Count
=>
3
;
public
static
Role
Admin
=>
Role
.
Create
(
1
,
"admin"
);
public
static
Role
Doctor
=>
Role
.
Create
(
2
,
"doctor"
);
public
static
Role
Receptionist
=>
Role
.
Create
(
3
,
"receptionist"
);
public
static
List
<
Role
>
GetAll
()
{
List
<
Role
>
roles
=
new
();
roles
.
Add
(
Admin
);
roles
.
Add
(
Doctor
);
roles
.
Add
(
Receptionist
);
return
roles
;
}
#
endregion
}
Clinics.Backend/Domain/Entities/Identity/Users/DoctorUser.cs
0 → 100644
View file @
00408ab3
using
Domain.Entities.Identity.UserRoles
;
using
Domain.Entities.People.Doctors
;
using
Domain.Primitives
;
using
Domain.Shared
;
namespace
Domain.Entities.Identity.Users
;
public
sealed
class
DoctorUser
:
Entity
{
#
region
Private
ctor
private
DoctorUser
(
int
id
)
:
base
(
id
)
{
}
private
DoctorUser
(
int
id
,
User
user
,
Doctor
doctor
)
:
base
(
id
)
{
User
=
user
;
Doctor
=
doctor
;
}
#
endregion
#
region
Properties
public
User
User
{
get
;
private
set
;
}
=
null
!;
public
Doctor
Doctor
{
get
;
private
set
;
}
=
null
!;
#
endregion
#
region
Methods
#
region
Static
factory
public
static
Result
<
DoctorUser
>
Create
(
string
username
,
string
hashedPassword
,
// User details
string
firstName
,
string
middleName
,
string
lastName
// Doctor details
)
{
Result
<
Doctor
>
doctorResult
=
Doctor
.
Create
(
firstName
,
middleName
,
lastName
);
if
(
doctorResult
.
IsFailure
)
return
Result
.
Failure
<
DoctorUser
>(
doctorResult
.
Error
);
Result
<
User
>
userResult
=
User
.
Create
(
username
,
hashedPassword
,
Roles
.
Doctor
.
Name
);
if
(
userResult
.
IsFailure
)
return
Result
.
Failure
<
DoctorUser
>(
userResult
.
Error
);
return
new
DoctorUser
(
0
,
userResult
.
Value
,
doctorResult
.
Value
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/Identity/Users/ReceptionistUser.cs
0 → 100644
View file @
00408ab3
using
Domain.Entities.Identity.UserRoles
;
using
Domain.Entities.People.Shared
;
using
Domain.Primitives
;
using
Domain.Shared
;
namespace
Domain.Entities.Identity.Users
;
public
sealed
class
ReceptionistUser
:
Entity
{
#
region
Private
ctor
private
ReceptionistUser
(
int
id
)
:
base
(
id
)
{
}
private
ReceptionistUser
(
int
id
,
User
user
,
PersonalInfo
personalInfo
)
:
base
(
id
)
{
User
=
user
;
PersonalInfo
=
personalInfo
;
}
#
endregion
#
region
Properties
public
User
User
{
get
;
private
set
;
}
=
null
!;
public
PersonalInfo
PersonalInfo
{
get
;
private
set
;
}
=
null
!;
#
endregion
#
region
Methods
#
region
Static
factory
public
static
Result
<
ReceptionistUser
>
Create
(
string
userName
,
string
hashedPassword
,
string
firstName
,
string
middleName
,
string
lastName
)
{
Result
<
PersonalInfo
>
personalInfoResult
=
PersonalInfo
.
Create
(
firstName
,
middleName
,
lastName
);
if
(
personalInfoResult
.
IsFailure
)
return
Result
.
Failure
<
ReceptionistUser
>(
personalInfoResult
.
Error
);
Result
<
User
>
userResult
=
User
.
Create
(
userName
,
hashedPassword
,
Roles
.
Receptionist
.
Name
);
if
(
userResult
.
IsFailure
)
return
Result
.
Failure
<
ReceptionistUser
>(
userResult
.
Error
);
return
new
ReceptionistUser
(
0
,
userResult
.
Value
,
personalInfoResult
.
Value
);
}
#
endregion
#
endregion
}
Clinics.Backend/Domain/Entities/Identity/Users/User.cs
0 → 100644
View file @
00408ab3
using
Domain.Entities.Identity.UserRoles
;
using
Domain.Errors
;
using
Domain.Primitives
;
using
Domain.Shared
;
namespace
Domain.Entities.Identity.Users
;
public
sealed
class
User
:
Entity
{
#
region
Private
ctor
private
User
(
int
id
)
:
base
(
id
)
{
}
private
User
(
int
id
,
string
userName
,
string
hashedPassword
,
Role
role
)
:
base
(
id
)
{
UserName
=
userName
;
HashedPassword
=
hashedPassword
;
Role
=
role
;
}
#
endregion
#
region
Properties
public
string
UserName
{
get
;
private
set
;
}
=
null
!;
public
string
HashedPassword
{
get
;
private
set
;
}
=
null
!;
public
Role
Role
{
get
;
private
set
;
}
=
null
!;
#
endregion
#
region
Methods
public
static
Result
<
User
>
Create
(
string
userName
,
string
hashedPassword
,
string
role
)
{
if
(
userName
is
null
||
hashedPassword
is
null
||
role
is
null
)
{
return
Result
.
Failure
<
User
>(
DomainErrors
.
InvalidValuesError
);
}
#
region
Check
role
Result
<
Role
>
selectedRole
=
Result
.
Failure
<
Role
>(
IdentityErrors
.
InvalidRole
);
List
<
Role
>
roles
=
Roles
.
GetAll
();
foreach
(
Role
roleItem
in
roles
)
{
if
(
roleItem
.
Name
==
role
)
selectedRole
=
roleItem
;
}
if
(
selectedRole
.
IsFailure
)
return
Result
.
Failure
<
User
>(
selectedRole
.
Error
);
#
endregion
return
new
User
(
0
,
userName
,
hashedPassword
,
selectedRole
.
Value
);
}
#
endregion
}
Clinics.Backend/Domain/Errors/IdentityErrors.cs
0 → 100644
View file @
00408ab3
using
Domain.Shared
;
namespace
Domain.Errors
;
public
static
class
IdentityErrors
{
public
static
Error
InvalidRole
=>
new
(
"Identity.InvalidRole"
,
"Role specified for user is invalid"
);
}
Clinics.Backend/Persistence/Configurations/Identity/Roles/RoleConfiguration.cs
0 → 100644
View file @
00408ab3
using
Domain.Entities.Identity.UserRoles
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Identity.Roles
;
public
class
RoleConfiguration
:
IEntityTypeConfiguration
<
Role
>
{
public
void
Configure
(
EntityTypeBuilder
<
Role
>
builder
)
{
builder
.
ToTable
(
nameof
(
Role
));
builder
.
Property
(
role
=>
role
.
Name
)
.
HasMaxLength
(
50
);
builder
.
HasIndex
(
role
=>
role
.
Name
)
.
IsUnique
();
}
}
Clinics.Backend/Persistence/Configurations/Identity/Users/DoctorUserConfiguration.cs
0 → 100644
View file @
00408ab3
using
Domain.Entities.Identity.Users
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Identity.Users
;
public
class
DoctorUserConfiguration
:
IEntityTypeConfiguration
<
DoctorUser
>
{
public
void
Configure
(
EntityTypeBuilder
<
DoctorUser
>
builder
)
{
builder
.
ToTable
(
nameof
(
DoctorUser
));
builder
.
Property
(
doctorUser
=>
doctorUser
.
Id
).
ValueGeneratedOnAdd
();
builder
.
HasOne
(
doctorUser
=>
doctorUser
.
User
)
.
WithOne
()
.
HasForeignKey
<
DoctorUser
>(
doctorUser
=>
doctorUser
.
Id
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
doctorUser
=>
doctorUser
.
Doctor
)
.
WithOne
()
.
HasForeignKey
<
DoctorUser
>(
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
Clinics.Backend/Persistence/Configurations/Identity/Users/ReceptionistUserConfiguration.cs
0 → 100644
View file @
00408ab3
using
Domain.Entities.Identity.Users
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Identity.Users
;
public
class
ReceptionistUserConfiguration
:
IEntityTypeConfiguration
<
ReceptionistUser
>
{
public
void
Configure
(
EntityTypeBuilder
<
ReceptionistUser
>
builder
)
{
builder
.
ToTable
(
nameof
(
ReceptionistUser
));
builder
.
Property
(
receptionistUser
=>
receptionistUser
.
Id
).
ValueGeneratedOnAdd
();
builder
.
HasOne
(
receptionistUser
=>
receptionistUser
.
User
)
.
WithOne
()
.
HasForeignKey
<
ReceptionistUser
>(
receptionistUser
=>
receptionistUser
.
Id
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
builder
.
HasOne
(
receptionistUser
=>
receptionistUser
.
PersonalInfo
)
.
WithOne
()
.
HasForeignKey
<
ReceptionistUser
>(
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
);
}
}
Clinics.Backend/Persistence/Configurations/Identity/Users/UserConfiguration.cs
0 → 100644
View file @
00408ab3
using
Domain.Entities.Identity.Users
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
namespace
Persistence.Configurations.Identity.Users
;
public
class
UserConfiguration
:
IEntityTypeConfiguration
<
User
>
{
public
void
Configure
(
EntityTypeBuilder
<
User
>
builder
)
{
builder
.
ToTable
(
nameof
(
User
));
builder
.
HasIndex
(
user
=>
user
.
UserName
)
.
IsUnique
();
builder
.
HasOne
(
user
=>
user
.
Role
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
);
}
}
Clinics.Backend/Persistence/Migrations/20240820202107_Add_Identity.Designer.cs
0 → 100644
View file @
00408ab3
This diff is collapsed.
Click to expand it.
Clinics.Backend/Persistence/Migrations/20240820202107_Add_Identity.cs
0 → 100644
View file @
00408ab3
using
Microsoft.EntityFrameworkCore.Migrations
;
#
nullable
disable
namespace
Persistence.Migrations
{
/// <inheritdoc />
public
partial
class
Add_Identity
:
Migration
{
/// <inheritdoc />
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
CreateTable
(
name
:
"Role"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
Name
=
table
.
Column
<
string
>(
type
:
"nvarchar(50)"
,
maxLength
:
50
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Role"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"User"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
.
Annotation
(
"SqlServer:Identity"
,
"1, 1"
),
UserName
=
table
.
Column
<
string
>(
type
:
"nvarchar(450)"
,
nullable
:
false
),
HashedPassword
=
table
.
Column
<
string
>(
type
:
"nvarchar(max)"
,
nullable
:
false
),
RoleId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_User"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_User_Role_RoleId"
,
column
:
x
=>
x
.
RoleId
,
principalTable
:
"Role"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
CreateTable
(
name
:
"DoctorUser"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
DoctorId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_DoctorUser"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_DoctorUser_Doctor_DoctorId"
,
column
:
x
=>
x
.
DoctorId
,
principalTable
:
"Doctor"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_DoctorUser_User_Id"
,
column
:
x
=>
x
.
Id
,
principalTable
:
"User"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateTable
(
name
:
"ReceptionistUser"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
),
PersonalInfoId
=
table
.
Column
<
int
>(
type
:
"int"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_ReceptionistUser"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_ReceptionistUser_PersonalInfo_PersonalInfoId"
,
column
:
x
=>
x
.
PersonalInfoId
,
principalTable
:
"PersonalInfo"
,
principalColumn
:
"Id"
);
table
.
ForeignKey
(
name
:
"FK_ReceptionistUser_User_Id"
,
column
:
x
=>
x
.
Id
,
principalTable
:
"User"
,
principalColumn
:
"Id"
);
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_DoctorUser_DoctorId"
,
table
:
"DoctorUser"
,
column
:
"DoctorId"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_ReceptionistUser_PersonalInfoId"
,
table
:
"ReceptionistUser"
,
column
:
"PersonalInfoId"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_Role_Name"
,
table
:
"Role"
,
column
:
"Name"
,
unique
:
true
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_User_RoleId"
,
table
:
"User"
,
column
:
"RoleId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_User_UserName"
,
table
:
"User"
,
column
:
"UserName"
,
unique
:
true
);
}
/// <inheritdoc />
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"DoctorUser"
);
migrationBuilder
.
DropTable
(
name
:
"ReceptionistUser"
);
migrationBuilder
.
DropTable
(
name
:
"User"
);
migrationBuilder
.
DropTable
(
name
:
"Role"
);
}
}
}
Clinics.Backend/Persistence/Migrations/ClinicsDbContextModelSnapshot.cs
View file @
00408ab3
...
...
@@ -22,6 +22,90 @@ namespace Persistence.Migrations
SqlServerModelBuilderExtensions
.
UseIdentityColumns
(
modelBuilder
);
modelBuilder
.
Entity
(
"Domain.Entities.Identity.UserRoles.Role"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasMaxLength
(
50
)
.
HasColumnType
(
"nvarchar(50)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"Name"
)
.
IsUnique
();
b
.
ToTable
(
"Role"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.DoctorUser"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"DoctorId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DoctorId"
)
.
IsUnique
();
b
.
ToTable
(
"DoctorUser"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
b
.
Property
<
int
>(
"PersonalInfoId"
)
.
HasColumnType
(
"int"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"PersonalInfoId"
)
.
IsUnique
();
b
.
ToTable
(
"ReceptionistUser"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"int"
);
SqlServerPropertyBuilderExtensions
.
UseIdentityColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"HashedPassword"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(max)"
);
b
.
Property
<
int
>(
"RoleId"
)
.
HasColumnType
(
"int"
);
b
.
Property
<
string
>(
"UserName"
)
.
IsRequired
()
.
HasColumnType
(
"nvarchar(450)"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"RoleId"
);
b
.
HasIndex
(
"UserName"
)
.
IsUnique
();
b
.
ToTable
(
"User"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Diseases.Disease"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
...
...
@@ -624,6 +708,55 @@ namespace Persistence.Migrations
b
.
ToTable
(
"EmployeeEmployee"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.DoctorUser"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.People.Doctors.Doctor"
,
"Doctor"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.DoctorUser"
,
"DoctorId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.Identity.Users.User"
,
"User"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.DoctorUser"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"Doctor"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Identity.Users.User"
,
"User"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
"Id"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
HasOne
(
"Domain.Entities.People.Shared.PersonalInfo"
,
"PersonalInfo"
)
.
WithOne
()
.
HasForeignKey
(
"Domain.Entities.Identity.Users.ReceptionistUser"
,
"PersonalInfoId"
)
.
OnDelete
(
DeleteBehavior
.
NoAction
)
.
IsRequired
();
b
.
Navigation
(
"PersonalInfo"
);
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Identity.Users.User"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Identity.UserRoles.Role"
,
"Role"
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Role"
);
});
modelBuilder
.
Entity
(
"Domain.Entities.Medicals.Medicines.Medicine"
,
b
=>
{
b
.
HasOne
(
"Domain.Entities.Medicals.Medicines.MedicineFormValues.MedicineForm"
,
"MedicineForm"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment