⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 model.smark.cs

📁 smark.data是基于C#开发的轻量级数据访问组件。 提供以下功能封: 1)提供了跨数据库类型操作能力 2)基于程线存储的数据访问上下文对象
💻 CS
📖 第 1 页 / 共 3 页
字号:
        }
        
        public static Employee ListFirst(Expression expression, string OrderBy) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.ListFirst(_context, expression, OrderBy);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static Employee ListFirst(Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.ListFirst(_context, expression, null);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static int Count(IConnectinContext context, Expression expression) {
            return EntityBase.OnCount(context, "Employees", expression, Employee.mGroupString);
        }
        
        public static int Count(Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.Count(_context, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object AVG(IConnectinContext context, string field, bool DISTINCT, Expression expression) {
            return EntityBase.OnAggregation(context, "Employees", "AVG", field, DISTINCT, expression, Employee.mGroupString);
        }
        
        public static object AVG(IConnectinContext context, string field, Expression expression) {
            return Employee.AVG(context, field, false, expression);
        }
        
        public static object AVG(IConnectinContext context, string field) {
            return Employee.AVG(context, field, false, null);
        }
        
        public static object AVG(IConnectinContext context, string field, bool DISTINCT) {
            return Employee.AVG(context, field, DISTINCT, null);
        }
        
        public static object AVG(string field, bool DISTINCT, Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.AVG(_context, field, DISTINCT, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object AVG(string field, Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.AVG(_context, field, false, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object AVG(string field) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.AVG(_context, field, false, null);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object AVG(string field, bool DISTINCT) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.AVG(_context, field, DISTINCT, null);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object SUM(IConnectinContext context, string field, bool DISTINCT, Expression expression) {
            return EntityBase.OnAggregation(context, "Employees", "SUM", field, DISTINCT, expression, Employee.mGroupString);
        }
        
        public static object SUM(IConnectinContext context, string field, Expression expression) {
            return Employee.SUM(context, field, false, expression);
        }
        
        public static object SUM(IConnectinContext context, string field) {
            return Employee.SUM(context, field, false, null);
        }
        
        public static object SUM(IConnectinContext context, string field, bool DISTINCT) {
            return Employee.SUM(context, field, DISTINCT, null);
        }
        
        public static object SUM(string field, bool DISTINCT, Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.SUM(_context, field, DISTINCT, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object SUM(string field, Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.SUM(_context, field, false, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object SUM(string field) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.SUM(_context, field, false, null);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object SUM(string field, bool DISTINCT) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.SUM(_context, field, DISTINCT, null);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object MAX(IConnectinContext context, string field, Expression expression) {
            return EntityBase.OnAggregation(context, "Employees", "MAX", field, false, expression, Employee.mGroupString);
        }
        
        public static object MAX(IConnectinContext context, string field) {
            return Employee.MAX(context, field, null);
        }
        
        public static object MAX(string field, Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.MAX(_context, field, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object MAX(string field) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.MAX(_context, field, null);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object MIN(IConnectinContext context, string field, Expression expression) {
            return EntityBase.OnAggregation(context, "Employees", "MIN", field, false, expression, Employee.mGroupString);
        }
        
        public static object MIN(IConnectinContext context, string field) {
            return Employee.MIN(context, field, null);
        }
        
        public static object MIN(string field, Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.MIN(_context, field, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static object MIN(string field) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.MIN(_context, field, null);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        protected override void OnLoadData(System.Data.IDataReader reader) {
            if ((reader["_EmployeeID"] != System.DBNull.Value)) {
                this.EmployeeID = ((int)(this.Convert(typeof(int), reader["_EmployeeID"])));
            }
            if ((reader["_FirstName"] != System.DBNull.Value)) {
                this.FirstName = ((string)(this.Convert(typeof(string), reader["_FirstName"])));
            }
            if ((reader["_LastName"] != System.DBNull.Value)) {
                this.LastName = ((string)(this.Convert(typeof(string), reader["_LastName"])));
            }
            if ((reader["_Country"] != System.DBNull.Value)) {
                this.Country = ((string)(this.Convert(typeof(string), reader["_Country"])));
            }
            if ((reader["_ReportsTo"] != System.DBNull.Value)) {
                this.ReportsTo = ((int)(this.Convert(typeof(int), reader["_ReportsTo"])));
            }
        }
        
        public static void Delete(IConnectinContext context, Expression expression) {
            EntityBase.OnDelete(context, "Employees", expression);
        }
        
        public static void Delete(Expression expression) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                Employee.Delete(_context, expression);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public static Employee Load(IConnectinContext context, int id) {
            return EntityBase.OnLoad<Employee>(context, Employee.mSelectString, "EmployeeID", id);
        }
        
        public static Employee Load(int id) {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                return Employee.Load(_context, id);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public virtual void Save(IConnectinContext context) {
            System.Collections.Generic.IList<Field> _fields;
            Field _id;
            Field item;
            _fields = new System.Collections.Generic.List<Field>();
            _id = new Field();
            _id.Name = "EmployeeID";
            _id.Value = this.EmployeeID;
            _id.GetValueBy = "SELECT @@IDENTITY";
            _id.GetValueAfterInsert = true;
            item = new Field();
            item.Name = "FirstName";
            item.Value = this.FirstName;
            _fields.Add(item);
            item = new Field();
            item.Name = "LastName";
            item.Value = this.LastName;
            _fields.Add(item);
            item = new Field();
            item.Name = "Country";
            item.Value = this.Country;
            _fields.Add(item);
            item = new Field();
            item.Name = "ReportsTo";
            item.Value = this.ReportsTo;
            _fields.Add(item);
            this.OnSave(context, "Employees", _fields, _id);
            this.EmployeeID = ((int)(this.Convert(typeof(int), _id.Value)));
        }
        
        public virtual void Save() {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                this.Save(_context);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
        
        public virtual void Delete(IConnectinContext context) {
            this.OnDeleteObject(context, "Employees", "EmployeeID", this.EmployeeID);
        }
        
        public virtual void Delete() {
            IConnectinContext _context;
            _context = DBContext.Context;
            try {
                this.Delete(_context);
            }
            catch (System.Exception e_) {
                throw e_;
            }
            finally {
                _context.Dispose();
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -