I am trying to insert multiple records around 1000 from my list to MS SQL DB from my ASP.NET Core app using Entity framework. While inserting each record <g class="gr_ gr_30 gr-alert gr_tiny gr_spell gr_run_anim ContextualSpelling multiReplace"
data-gr-id="30" id="30">i</g> am making few database interactions to check some values. It's taking <g class="gr_ gr_97 gr-alert gr_spell gr_run_anim ContextualSpelling" data-gr-id="97" id="97">a
way</g> long time to insert the records.
SQLBulk Copy won't work as am checking conditions in between each insert. Is there any other way to do it?
Here's the code-
List<storecsv> insert = new List<storecsv>();
foreach (StoreCSV storecsv in insert)
{
if (InsertOrUpdateStore(storecsv) == 0)
{
noninserted.Add(storecsv);
}
}
private int InsertOrUpdateStore(StoreCSV dr){
//Few DB interactions
context.Markets.Add(Market);
}