LambdaToSql/TableStruct/BaseTable.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LambdaToSql.TableStruct
{
    internal abstract class BaseTable
    {
        /// <summary>
        /// 缓存帮助类
        /// </summary>
        public FrameWork.CacheHelper Cache = FrameWork.CacheHelper.Instance;

        /// <summary>
        /// 数据库上下文对象
        /// </summary>
        public LambdaToSql.EntityModel.DbContext Context { get; set; }

        /// <summary>
        /// 表结构
        /// </summary>
        public Dictionary<string, LambdaToSql.EntityModel.Table> DicTable
        {
            get
            {
                Dictionary<string, LambdaToSql.EntityModel.Table> table;
                if (!string.IsNullOrEmpty(this.Context.ConnectionStringName))
                {
                    if (Cache[this.Context.ConnectionStringName] != null)
                    {
                        table = Cache[this.Context.ConnectionStringName] as Dictionary<string, LambdaToSql.EntityModel.Table>;
                    }
                    else
                    {
                        table = GetDataTable();
                        Cache[this.Context.ConnectionStringName] = table;
                    }
                }
                else
                {
                    table = GetDataTable();
                }
                return table;
            }
        }

        /// <summary>
        /// 获取数据库表字段实体
        /// </summary> 
        /// <returns></returns>
        public virtual Dictionary<string, LambdaToSql.EntityModel.Table> GetDataTable()
        {
            return null;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。