Browse Source

Update Demo

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
53409f5b3a
  1. 4
      Src/Asp.Net/MySqlTest/Demos/1_Query.cs
  2. 2
      Src/Asp.Net/MySqlTest/Demos/DemoBase.cs
  3. 2
      Src/Asp.Net/SqlServerTest/Demos/DemoBase.cs
  4. 3
      Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs
  5. 4
      Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs
  6. 2
      Src/Asp.Net/SqliteTest/Demos/DemoBase.cs

4
Src/Asp.Net/MySqlTest/Demos/1_Query.cs

@ -188,8 +188,8 @@ namespace OrmTest.Demo
{
var db = GetInstance();
db.Ado.BeginTran();
var t1 = db.Ado.SqlQuery<string>("select 'a'");
var t2 = db.Ado.GetInt("select 1");
var t1 = db.Ado.SqlQuery<string>("select 'a'",new { id = 1 });
var t2 = db.Ado.GetInt("select 1",new Dictionary<string, object>() { { "id",1} });
var t3 = db.Ado.GetDataTable("select 1 as id");
db.Ado.CommitTran();
//more

2
Src/Asp.Net/MySqlTest/Demos/DemoBase.cs

@ -14,7 +14,7 @@ namespace OrmTest.Demo
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it=>it.ParameterName,it=>it.Value)));
Console.WriteLine();
};
return db;

2
Src/Asp.Net/SqlServerTest/Demos/DemoBase.cs

@ -14,7 +14,7 @@ namespace OrmTest.Demo
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
Console.WriteLine();
};
return db;

3
Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs

@ -26,7 +26,10 @@ namespace SqlSugar
if (isDictionary)
DictionaryToParameters(parameters, sqlParameterKeyWord, result, entityType);
else
{
Check.Exception(!entityType.IsAnonymousType(), "The parameter format is wrong. \nUse new{{xx=xx, xx2=xx2}} or \nDictionary<string, object> or \nSugarParameter [] ");
ProperyToParameter(parameters, propertyInfo, sqlParameterKeyWord, result, entityType);
}
}
return result.ToArray();
}

4
Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs

@ -599,7 +599,7 @@ namespace SqlSugar
{
if (parameters == null || parameters.Length == 0)
{
action(sql, null);
action(sql, new SugarParameter[] { });
}
else
{
@ -627,7 +627,7 @@ namespace SqlSugar
{
if (parameters == null || parameters.Length == 0)
{
action(sql, null);
action(sql, new SugarParameter[] { });
}
else
{

2
Src/Asp.Net/SqliteTest/Demos/DemoBase.cs

@ -14,7 +14,7 @@ namespace OrmTest.Demo
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars));
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
Console.WriteLine();
};
return db;

Loading…
Cancel
Save