[Solved] Entity Framework populate entity at starting [closed]


Really, you are asking two different questions. Entity Framework is not a database administration tool and as such does not have any functionality for directly loading data from a spreadsheet.

If you research each part of your question separately, you might have more luck.

Seeding data with Entity Framework

Reading Excel Files with C#

Reply to comment:

if (!context.PostalCodes.Any())
{
    IEnumerable<PostalCode> postalCodes = ReadPostalCodes();
    foreach(var postalCode in postalCodes)
    {
        context.PostalCodes.Add(postalCode);
    }
    context.SaveChanges();
}

1

solved Entity Framework populate entity at starting [closed]