Using MSSQLDataService when updating objects with empty strings

MSSQLDataService converts empty strings to NULL when updating objects.

When building a limitations, if the argument in the equality check is passed String.Empty, the request will be generated as IS NULL and everything works as it should. This simplification eliminates the need to write complex Where clauses-expressions.

If there is a need to distinguish between NULL and String.Empty, it is possible to unasledovala from MSSQLDataService and override method

public virtual string ConvertSimpleValueToQueryValueString(object value)

so that was not replaced

if (valType == typeof(string))
{
	if ((string)value == string.Empty)
		return "NULL";
	else
		return "'" + value.ToString().Replace("'", """) + "'";
}

Special attention should be paid to this feature, if you use the imported data or the SQL statements that run in a bypass service data.

Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru