Commit fd9ec2b4 authored by Sam Saffron's avatar Sam Saffron

improved test, set length for string params

parent 047eef9f
......@@ -269,13 +269,19 @@ private static IDbCommand SetupCommand(IDbConnection cnn, SqlTransaction tranact
var list = info.Val as IEnumerable;
var count = 0;
bool isString = info.Val is IEnumerable<string>;
if (list != null)
{
foreach (var item in list)
{
count++;
cmd.Parameters.Add(new SqlParameter("@" + info.Name + count, item));
var sqlParam = new SqlParameter("@" + info.Name + count, item);
if (isString)
{
sqlParam.Size = 4000;
}
cmd.Parameters.Add(sqlParam);
}
cmd.CommandText = cmd.CommandText.Replace("@" + info.Name,
......
......@@ -89,15 +89,19 @@ public class Dog
public int IgnoredProperty { get { return 1; } }
}
public void TestIntSupportsNull()
public void TestStrongType()
{
var dog = connection.ExecuteMapperQuery<Dog>("select Age = @Age", new { Age = (int?)null });
var guid = Guid.NewGuid();
var dog = connection.ExecuteMapperQuery<Dog>("select Age = @Age, Id = @Id", new { Age = (int?)null, Id = guid });
dog.Count()
.IsEquals(1);
dog.First().Age
.IsNull();
dog.First().Id
.IsEquals(guid);
}
public void TestExpando()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment