franciscojunior/Npgsql2 — pull request #38 by glenebob (2013-08-05 18:13:08+00:00)
Title: Native to backend conversion code

Second attempt, from another branch. This kills the large changes to the EF code, and adds some additional features and efficiencies compared to pull request 37..

Fixed BasicNativeToBackendTypeConverter.ToBinary() (broken in commit d2b636a): Reverted back to the correct "\" when escaping byte values.
Added class BackendToNativeTypeConverterOptions to describe UseConformantStrings, Supports_E_StringPrefix and SupportsHexByteFormat. Maintain one on each connector for use during encoding.
Push E string prefix and escaping logic down the conversion stack so that array elements can use the same logic.
Only escape \ if the backend is expecting non conformant strings.
Implement string escapes in a function rather than using multiple string.Replace() calls.
Do all bytea string escaping in ToBinary(), and then do not escape its output again.
Encode bytea data in the new hex format when possible (>= 9.0), which cuts some such strings in half.
Don't use the E prefix if the backend doesn't understand it.
Assume non conformant strings on all version 2 connections, since we can't track changes to the setting. The E prefix causes this to work if the backend is expecting conformant strings.
Expose UseConformantStrings, Supports_E_StringPrefix and SupportsHexByteFormat via NpgsqlConnection.