DD.WellWorkover.Cloud/AsbCloudDb/Model/DefaultData/EntityFiller.cs

19 lines
466 B
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
2022-11-23 17:26:21 +05:00
using System.Collections.Generic;
namespace AsbCloudDb.Model.DefaultData
{
2022-11-25 09:34:20 +05:00
public abstract class EntityFiller<TEntity> : IEntityFiller
where TEntity : class
{
2022-11-23 17:26:21 +05:00
public abstract TEntity[] GetData();
public void FillData(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TEntity>(entity =>
{
entity.HasData(GetData());
});
}
}
}