コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //设置序列
            OracleConfig.SequenceMapping = new List <PubModel.SequenceModel>()
            {
                new PubModel.SequenceModel()
                {
                    ColumnName = "ID", TableName = "STUDENT", Value = "SEQ_D"
                },
                new PubModel.SequenceModel()
                {
                    ColumnName = "ID", TableName = "SCHOOL", Value = "SEQ_D"
                }
            };

            using (SqlSugarClient db = SugarDaoSerNum.GetInstance())//开启数据库连接
            {
                var obj = Convert.ToInt32(db.Insert <STUDENT>(new STUDENT()
                {
                }));

                var name = db.Queryable <STUDENT>().Single(it => it.ID == obj).NAME;


                var obj2 = Convert.ToInt32(db.Insert <SCHOOL>(new SCHOOL()
                {
                }));

                var name2 = db.Queryable <SCHOOL>().Single(it => it.ID == obj2).NAME;
            }
        }
コード例 #2
0
ファイル: SerialNumber.aspx.cs プロジェクト: trycath/SqlSugar
        protected void Page_Load(object sender, EventArgs e)
        {
            using (SqlSugarClient db = SugarDaoSerNum.GetInstance())    //开启数据库连接
            {
                var obj = Convert.ToInt32(db.Insert <Student>(new Student()
                {
                }));

                var name = db.Queryable <Student>().Single(it => it.id == obj).name;


                var obj2 = Convert.ToInt32(db.Insert <School>(new School()
                {
                }));

                var name2 = db.Queryable <School>().Single(it => it.id == obj2).name;
            }
        }