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(); db.DbMaintenance.TruncateTable(); db.Insertable(new Student() { type = DbType.Tidb }).ExecuteCommand(); if (db.Queryable().First().type != DbType.Tidb) Cases.Init(); if (db.Queryable().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; } } } }