-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perf: improve batching for TPH #3954
Labels
area-perf
area-relational-mapping
area-save-changes
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Milestone
Comments
This issue maps to a TODO in |
63 tasks
4 tasks
This was referenced Jan 14, 2022
@AndriySvyryd do you remember what exactly this refers to, and whether it's still relevant? At the very least derived and base inserts into TPH seem to be batched already (code below). Code sampleawait using var ctx = new BlogContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();
ctx.Add(new Derived { BaseProp = "Base", DerivedProp = "Derived" });
ctx.Add(new Base { BaseProp = "Base2" });
await ctx.SaveChangesAsync();
public class BlogContext : DbContext
{
public DbSet<Base> Base { get; set; }
public DbSet<Derived> Derived { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseSqlServer(@"Server=localhost;Database=test;User=SA;Password=Abcd5678;Connect Timeout=60;ConnectRetryCount=0;Encrypt=false",
o => o.MinBatchSize(1))
.LogTo(Console.WriteLine, LogLevel.Information)
.EnableSensitiveDataLogging();
}
public class Base
{
public int Id { get; set; }
public string BaseProp { get; set; }
}
public class Derived : Base
{
public string DerivedProp { get; set; }
} |
ajcvickers
added
propose-punt
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
and removed
propose-punt
labels
Apr 22, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-perf
area-relational-mapping
area-save-changes
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
We could create larger batches by combining operations on entities of base and derived types.
The text was updated successfully, but these errors were encountered: