dev
Line | |
---|
1 | using Microsoft.EntityFrameworkCore;
|
---|
2 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
---|
3 | using FinkiChattery.Persistence.Models;
|
---|
4 |
|
---|
5 | namespace FinkiChattery.Persistence.Configurations
|
---|
6 | {
|
---|
7 | public abstract class BaseConfig<T> : IEntityTypeConfiguration<T> where T : BaseEntity
|
---|
8 | {
|
---|
9 | protected BaseConfig(string schema)
|
---|
10 | {
|
---|
11 | Schema = schema;
|
---|
12 | }
|
---|
13 |
|
---|
14 | protected string Schema { get; }
|
---|
15 |
|
---|
16 | public virtual void Configure(EntityTypeBuilder<T> builder)
|
---|
17 | {
|
---|
18 | builder.HasKey(x => x.Id);
|
---|
19 |
|
---|
20 | builder.Property(x => x.Id).HasColumnName("Id").HasColumnType("bigint").IsRequired().ValueGeneratedOnAdd();
|
---|
21 | builder.Property(x => x.Uid).HasColumnName("Uid").HasColumnType("uniqueidentifier").IsRequired();
|
---|
22 | }
|
---|
23 | }
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.