SqlServer和sqlite都用的Fsql
数据库的连接,DataSource对应我们sqlserve的服务器名称
1 using System; 2 namespace SG 3 { 4 public static class DataBaseCommon 5 { 6 public static string DataSource = @"DESKTOP-EHQE9K9\AA"; 7 public static void CreateDatabase(string name) 8 { 9 string connectionString = $"Data Source={DataSource};User Id=SA;Password=123456;Initial Catalog=master;TrustServerCertificate=true;Pooling=true;Min Pool Size=1"; 10 IFreeSql fsql = new FreeSql.FreeSqlBuilder() 11 .UseConnectionString(FreeSql.DataType.SqlServer, connectionString) 12 .UseAutoSyncStructure(true) //自动同步实体结构到数据库 13 .Build(); //请务必定义成 Singleton 单例模式 14 } 15 } 16 }
枚举八个数据库表名称
using system; namespace SG {
public static class DataBaseCommon()
{
public static QueryedTableName QuerTableName;
} public enum QueryedTableName { Table_RC1, Table_RC2, Table_OVEN_1_Exhaust, Table_OVEN_1_Hepa, Table_OVEN_1_Temp, Table_OVEN_2Exhaust, Table_OVEN_2_Temp, Table_OVEN_2_Hepa, }
} }
所有的类都派生于object类,object是所有类的基类
类包含 字段,属性,方法
写的随笔根据自己的思路想法写的
可能会有写乱,欢迎指导指正!
标签:数据库,SqlServer,static,OVEN,Table,public From: https://www.cnblogs.com/lulu-shi/p/17037683.html