Reputation: 29
I am trying for Bulk Insertion to One to many relation.
I have two classes:
public class Parent {
public int Id {
get;
set;
}
public string Name {
get;
set;
}
public virtual ICollection<Child> Child {
get;
set;
} = new List < Child > ();
}
public class Child {
public int ChildId {
get;
set;
}
public virtual Parent Parent {
get;
set;
}
}
When I did some R&D , I found we can use IncludeGraph=true
for child table insertion.
public void BulkInsertAsync(IEnumerable<Parent> parent) {
_context.BulkInsert<Parent>(parent.ToList(), options => options.IncludeGraph = true);
}
But the problem is that I am getting this error:
Bulk Config does not contain definition for Include Graph
Am I missing any assembly reference?
Please help me out in this.
Upvotes: 2
Views: 523
Reputation: 1842
You need to upgrade your EfCore.BulkExtensions package. I had the same error on 3.1.6; upgrading to 3.6.3 allowed this to work. Note that I also had to upgrade EFCore from 3.1.9 to 3.1.21
Upvotes: 1