public void SqlServerCustomNVarCharMaxOverflowParameterSizeAsDataParameter([IncludeDataSources(TestProvName.AllSqlServer2005Plus)] string context) { using (var db = new DataConnection(context, new MappingSchema())) { SetupCustomTypes(db.MappingSchema, true); using (var table = db.CreateLocalTable <AllTypesCustomMaxLength>()) { var value = new string('я', 5000); table.Insert(() => new AllTypesCustomMaxLength() { NVarChar = new NVarChar() { Value = value } }); var records = table.ToList(); var p = new NVarChar() { Value = value }; var sql = table.Where(t => t.NVarChar == p).ToString() !; Assert.AreEqual(1, records.Count); Assert.IsNotNull(records[0].NVarChar); Assert.AreEqual(value, records[0].NVarChar !.Value); Assert.That(sql.Contains("NVarChar(5000) -- String")); } } }
public void SqlServerCustomNVarCharKnownOverflowParameterSizeAsDataParameter([IncludeDataSources(TestProvName.AllSqlServer)] string context) { using (var db = new DataConnection(context, new MappingSchema())) { SetupCustomTypes(db.MappingSchema, true); var p = new NVarChar() { Value = "abcdeabcdeabcdeabcde1" }; var sql = db.GetTable <AllTypesCustomWithLength>().Where(t => t.NVarcharDataType == p).ToString(); Console.WriteLine(sql); Assert.That(sql, Contains.Substring("(4000)")); } }
public void SqlServerCustomNVarChar4000ParameterSize([IncludeDataSources(TestProvName.AllSqlServer)] string context) { using (var db = new DataConnection(context, new MappingSchema())) { SetupCustomTypes(db.MappingSchema); var p = new NVarChar() { Value = "abc" }; var sql = db.GetTable <AllTypesCustom>().Where(t => t.NVarcharDataType == p).ToString(); Console.WriteLine(sql); Assert.That(sql, Contains.Substring("NVarChar -- String")); } }