コード例 #1
0
    {        /// <summary>
             /// 获取当前数据上下文
             /// </summary>
             /// <returns></returns>
        public static JCMSDbContext GetCurrentContext()
        {
            JCMSDbContext db = CallContext.GetData("Default") as JCMSDbContext;

            if (db == null)
            {
                db = new JCMSDbContext();
                CallContext.SetData("Default", db);
            }
            return(db);
        }
コード例 #2
0
        public static void GetCurrentContextSetDatabaseExecuteSqlCommand(string FullName)
        {
            JCMSDbContext db = CallContext.GetData("Default") as JCMSDbContext;

            db.Database.ExecuteSqlCommand(System.IO.File.ReadAllText(FullName, Encoding.Default));
        }