I am using the Entity Framework and Linq technology but when I tried to use parallel.For it happens I have an Exception
This is my attempt
class Program
{
static void Main(string[] args)
{
DbContextClass db = new DbContextClass();
Parallel.For(0, 10, i =>
{
Category ct = new Category
{
NameCategory = "SomeText"
};
db.Categories.Add(ct);
});
db.SaveChanges();
Console.ReadKey();
}
}