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