ReadFromByteArray in Audit Generated.CS

Jan 13, 2011 at 4:55 PM
Edited Jan 13, 2011 at 4:55 PM

Looks like the new version of nHydrate does not write the following function into the Audit object file of classes with varbinary fields as it did before.

private static byte[] ReadFromByteArray(int ordinal, IDataReader dataReader)

{

 int bufferSize = 1024 * 10;

int startIndex = 0;

byte[] outbyte = new byte[bufferSize];

List<byte> retval = new List<byte>();


// Read the bytes into outbyte[] and retain the number of bytes returned.

long count = dataReader.GetBytes(ordinal, startIndex, outbyte, 0, bufferSize);
// Continue reading and writing while there are bytes beyond the size of the buffer.

while (count == bufferSize)

{

retval.AddRange(outbyte); startIndex += bufferSize;

count = dataReader.GetBytes(1, startIndex, outbyte, 0, bufferSize); }

return retval.ToArray(); }

Coordinator
Jan 14, 2011 at 12:54 AM

This method actually is generated but only for Binary fields. It needs to be generated for Binary, Image, and VarBinary fields. This is a mistake. This will be in the next version. Thanks for the find.