Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payments
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
Юнусов Ибрагим
payments
Commits
2c7f0664
Commit
2c7f0664
authored
Jul 27, 2022
by
Юнусов Ибрагим
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил ограничение поля в БД
parent
7d58cb25
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
UserBalanceDbMap.cs
...tructures/Databases/MapConfigurations/UserBalanceDbMap.cs
+15
-0
UserDbMap.cs
.../Infrastructures/Databases/MapConfigurations/UserDbMap.cs
+18
-0
PaymentDbContext.cs
...ment.WebApi/Infrastructures/Databases/PaymentDbContext.cs
+4
-0
No files found.
Payments/Payment.WebApi/Infrastructures/Databases/MapConfigurations/UserBalanceDbMap.cs
0 → 100644
View file @
2c7f0664
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
Payment.WebApi.Models.DbModels
;
namespace
Payment.WebApi.Infrastructures.Databases.MapConfigurations
;
public
class
UserBalanceDbMap
:
IEntityTypeConfiguration
<
UserBalance
>
{
public
void
Configure
(
EntityTypeBuilder
<
UserBalance
>
builder
)
{
builder
.
HasKey
(
opt
=>
opt
.
Id
);
builder
.
Property
(
opt
=>
opt
.
Currency
).
HasMaxLength
(
8
).
IsRequired
();
builder
.
Property
(
opt
=>
opt
.
Amount
).
HasColumnType
(
"NUMERIC(18,2)"
);
}
}
\ No newline at end of file
Payments/Payment.WebApi/Infrastructures/Databases/MapConfigurations/UserDbMap.cs
0 → 100644
View file @
2c7f0664
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Metadata.Builders
;
using
Payment.WebApi.Models.DbModels
;
namespace
Payment.WebApi.Infrastructures.Databases.MapConfigurations
;
public
class
UserDbMap
:
IEntityTypeConfiguration
<
User
>
{
public
void
Configure
(
EntityTypeBuilder
<
User
>
builder
)
{
builder
.
HasKey
(
opt
=>
opt
.
Id
);
builder
.
Property
(
opt
=>
opt
.
FirstName
).
HasColumnType
(
"VARCHAR(256)"
).
IsRequired
();
builder
.
Property
(
opt
=>
opt
.
LastName
).
HasColumnType
(
"VARCHAR(256)"
);
builder
.
Property
(
opt
=>
opt
.
MiddleName
).
HasColumnType
(
"VARCHAR(256)"
);
builder
.
Property
(
opt
=>
opt
.
Email
).
HasMaxLength
(
128
).
IsRequired
();
builder
.
Property
(
opt
=>
opt
.
Age
).
HasColumnType
(
"SMALLINT"
);
}
}
\ No newline at end of file
Payments/Payment.WebApi/Infrastructures/Databases/PaymentDbContext.cs
View file @
2c7f0664
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
using
Payment.WebApi.Infrastructures.Databases.MapConfigurations
;
using
Payment.WebApi.Models.DbModels
;
using
Payment.WebApi.Models.DbModels
;
namespace
Payment.WebApi.Infrastructures.Databases
;
namespace
Payment.WebApi.Infrastructures.Databases
;
...
@@ -24,5 +25,8 @@ public class PaymentDbContext : DbContext
...
@@ -24,5 +25,8 @@ public class PaymentDbContext : DbContext
modelBuilder
.
SeedUser
();
modelBuilder
.
SeedUser
();
modelBuilder
.
SeedSupplier
();
modelBuilder
.
SeedSupplier
();
modelBuilder
.
SeedUserBalance
();
modelBuilder
.
SeedUserBalance
();
modelBuilder
.
ApplyConfiguration
(
new
UserDbMap
());
modelBuilder
.
ApplyConfiguration
(
new
UserBalanceDbMap
());
}
}
}
}
\ No newline at end of file
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