提交 fd9ec2b4 编写于 作者: S Sam Saffron

improved test, set length for string params

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册