forked from ddrilling/AsbCloudServer
18 lines
440 B
C#
18 lines
440 B
C#
|
using Microsoft.EntityFrameworkCore;
|
|||
|
|
|||
|
namespace AsbCloudDb.Model.DefaultData
|
|||
|
{
|
|||
|
internal abstract class EntityFiller<TEntity> : IEntityFiller
|
|||
|
where TEntity : class
|
|||
|
{
|
|||
|
protected abstract TEntity[] GetData();
|
|||
|
|
|||
|
public void FillData(ModelBuilder modelBuilder)
|
|||
|
{
|
|||
|
modelBuilder.Entity<TEntity>(entity =>
|
|||
|
{
|
|||
|
entity.HasData(GetData());
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
}
|