Update to latest packages and show examples
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using GerstITS.Data.EntityFramework;
|
||||
using GerstITS.Examples.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GerstITS.Examples.Data.Mappings;
|
||||
|
||||
internal sealed class CustomerEntityMapping : EntityMappingBase<CustomerEntity>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
protected override string TableName => "Customers";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void AddKeyMapping(EntityTypeBuilder<CustomerEntity> entity)
|
||||
{
|
||||
entity.HasKey(i => i.Id);
|
||||
}
|
||||
|
||||
protected override void AddPropertyMappings(EntityTypeBuilder<CustomerEntity> entity)
|
||||
{
|
||||
entity.Property(i => i.FirstName).HasMaxLength(100).IsRequired();
|
||||
entity.Property(i => i.LastName).HasMaxLength(100).IsRequired();
|
||||
entity.Property(i => i.EMail).HasMaxLength(250).IsRequired();
|
||||
|
||||
entity.Property(i => i.CreatedBy).HasMaxLength(100);
|
||||
entity.Property(i => i.ModifiedBy).HasMaxLength(100);
|
||||
entity.Property(i => i.DeactivatedBy).HasMaxLength(100);
|
||||
|
||||
entity.Property(i => i.Version).IsConcurrencyToken();
|
||||
}
|
||||
|
||||
protected override void AddNavigationProperties(EntityTypeBuilder<CustomerEntity> entity)
|
||||
{
|
||||
entity.HasMany(i => i.Notes)
|
||||
.WithOne()
|
||||
.HasForeignKey(i => i.CustomerId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using GerstITS.Data.EntityFramework;
|
||||
using GerstITS.Examples.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GerstITS.Examples.Data.Mappings;
|
||||
|
||||
internal sealed class CustomerNoteEntityMapping : EntityMappingBase<CustomerNoteEntity>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
protected override string TableName => "CustomerNotes";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void AddKeyMapping(EntityTypeBuilder<CustomerNoteEntity> entity)
|
||||
{
|
||||
entity.HasKey(i => i.Id);
|
||||
}
|
||||
|
||||
protected override void AddPropertyMappings(EntityTypeBuilder<CustomerNoteEntity> entity)
|
||||
{
|
||||
entity.Property(i => i.Text).HasMaxLength(2000).IsRequired();
|
||||
|
||||
entity.Property(i => i.CreatedBy).HasMaxLength(100);
|
||||
entity.Property(i => i.HistorySet).HasMaxLength(50);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user