I have a case where I want to put EF inserts inside Task and return results without making user to wait like this:
Task.Factory.StartNew(() =>
{
InsertToDatabase(data);
});
But for this I must create new DbContext
because other one will be disposed of course so I need to initialize repositories again. I am using constructor injection but in this case I can't resolve this dependency. How I should create my repositories inside Task.Factory?