初始提交
This commit is contained in:
25
Infrastructure/Hncore.Infrastructure/EF/EntityMapBase.cs
Normal file
25
Infrastructure/Hncore.Infrastructure/EF/EntityMapBase.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Hncore.Infrastructure.EF
|
||||
{
|
||||
public interface IEntityMap
|
||||
{
|
||||
void Map(ModelBuilder builder);
|
||||
}
|
||||
|
||||
public interface IEntityMap<TEntityType> : IEntityMap where TEntityType : class
|
||||
{
|
||||
void Map(EntityTypeBuilder<TEntityType> builder);
|
||||
}
|
||||
|
||||
public abstract class EntityMapBase<T> : IEntityMap<T> where T : class
|
||||
{
|
||||
public abstract void Map(EntityTypeBuilder<T> builder);
|
||||
|
||||
public void Map(ModelBuilder builder)
|
||||
{
|
||||
Map(builder.Entity<T>());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user