TortugaResearch / Tortuga.Chain

A fluent ORM for .NET
Other
335 stars 22 forks source link

Default to not using CommandBehavior.SequentialAccess #415

Closed Grauenwolf closed 2 years ago

Grauenwolf commented 2 years ago

In most cases using the Default (non-sequential) access mode is the better choice, as it allows an easier programming model (you can access any column in any order) and you will get better performance using ReadAsync. However, since non-sequential access mode has to store the data for the entire row, it can cause issues if you are reading a large column from the server (such as varbinary(MAX), varchar(MAX), nvarchar(MAX) or XML). In this case using sequential access mode will allow you to stream these large columns rather than having to buffer the entire column into memory.

https://docs.microsoft.com/en-us/archive/blogs/adonet/using-sqldatareaders-new-async-methods-in-net-4-5

Make using CommandBehavior.SequentialAccess an opt-in.


Also ensure that we are using ReadAsync and are NOT using IsDBNullAsync or GetFieldValueAsync<T>.