mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Addd demo
This commit is contained in:
@@ -29,6 +29,7 @@ namespace MongoDbTest
|
|||||||
InsertOrUpdate.Init();
|
InsertOrUpdate.Init();
|
||||||
Unitdafasdys.Init();
|
Unitdafasdys.Init();
|
||||||
Enum.Init();
|
Enum.Init();
|
||||||
|
Enum2.Init();
|
||||||
|
|
||||||
//主键不是ObjectId类型用例
|
//主键不是ObjectId类型用例
|
||||||
//The primary key is not an ObjectId type use case
|
//The primary key is not an ObjectId type use case
|
||||||
|
30
Src/Asp.NetCore2/MongoDbTest/UnitTest/Enum2.cs
Normal file
30
Src/Asp.NetCore2/MongoDbTest/UnitTest/Enum2.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using SqlSugar.MongoDb;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MongoDbTest
|
||||||
|
{
|
||||||
|
internal class Enum2
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = DbHelper.GetNewDb();
|
||||||
|
db.CodeFirst.InitTables<Student>();
|
||||||
|
db.DbMaintenance.TruncateTable<Student>();
|
||||||
|
db.Insertable(new Student() { type = DbType.Tidb }).ExecuteCommand();
|
||||||
|
if (db.Queryable<Student>().First().type != DbType.Tidb) Cases.Init();
|
||||||
|
if (db.Queryable<Student>().Where(s=>s.type==DbType.Tidb).First().type != DbType.Tidb) Cases.Init();
|
||||||
|
}
|
||||||
|
[SqlSugar.SugarTable("UnitStudentadsdujj3z1")]
|
||||||
|
public class Student : MongoDbBase
|
||||||
|
{
|
||||||
|
//存储string枚举
|
||||||
|
[SugarColumn(SqlParameterDbType =typeof(SqlSugar.DbConvert.EnumToStringConvert))]
|
||||||
|
public DbType type { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user