mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:07:23 +08:00
Update Demo
This commit is contained in:
parent
d9957c24e3
commit
bfc0590ab8
@ -8,6 +8,6 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = "Database=SqlSugar4xTest;Data Source=127.0.0.1;User Id=root;Password=root;pooling=false;CharSet=utf8;port=3306";
|
||||
public static string ConnectionString = "Database=SqlSugar4xTest;Data Source=127.0.0.1;User Id=root;Password=haosql;pooling=false;CharSet=utf8;port=3306";
|
||||
}
|
||||
}
|
||||
|
37
Src/Asp.NetCore2/SqlSeverTest/MySqlTest/Demos/J_Encode.cs
Normal file
37
Src/Asp.NetCore2/SqlSeverTest/MySqlTest/Demos/J_Encode.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using OrmTest.Demo;
|
||||
using OrmTest.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest.Demo
|
||||
{
|
||||
public class Encode : DemoBase
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = GetInstance();
|
||||
db.Utilities.RemoveCacheAll();
|
||||
|
||||
|
||||
var id=db.Insertable(new List<StudentEncode>() {
|
||||
new StudentEncode(){Name="✨✨✨👉🏻2" },
|
||||
new StudentEncode(){ Name="✨✨✨👉🏻" }
|
||||
} ).ExecuteReturnIdentity();
|
||||
|
||||
var entity = db.Queryable<StudentEncode>().OrderBy(it=>it.Id,SqlSugar.OrderByType.Desc).ToList();
|
||||
entity.First().Name = "✨update✨✨👉🏻";
|
||||
db.Updateable(entity.First()).ExecuteCommand();
|
||||
entity = db.Queryable<StudentEncode>().OrderBy(it => it.Id, SqlSugar.OrderByType.Desc).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
[SqlSugar.SugarTable("student")]
|
||||
public class StudentEncode {
|
||||
public int Id { get; set; }
|
||||
[SqlSugar.SugarColumn(IsTranscoding =true)]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
@ -39,6 +39,7 @@ namespace MySqlTest
|
||||
OrmTest.Demo.ComplexModel.Init();
|
||||
OrmTest.Demo.CodeFirst.Init();
|
||||
OrmTest.Demo.Queue.Init();
|
||||
OrmTest.Demo.Encode.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SqlSugar4XTest";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtest";
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=haosql;database=SqlSugar4XTest";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=haosql;database=sqlsugar4xtest";
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace OrmTest
|
||||
|
||||
get
|
||||
{
|
||||
return Environment.CurrentDirectory.Replace(@"\bin\Debug", "");
|
||||
return Environment.CurrentDirectory.Replace(@"\bin\Debug", "").Replace(@"\netcoreapp2.0","");
|
||||
}
|
||||
}
|
||||
public static string ConnectionString = @"DataSource=" + GetCurrentProjectPath + @"\DataBase\SqlSugar4xTest.sqlite";
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user