zoukankan      html  css  js  c++  java
  • ModelContext模型上下文

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

     

    namespace TeamService.Data

    {

        public class ModelContextStatus

        {

            public const int DISABLED = 0x0000;

            public const int NORMAL = 0x0001;

            public const int DELETED = 0x0004;

        }

        /// <summary>

        /// EntityContext class provides unified access to EF entities

        /// </summary>

        public class ModelContext

        {

            public const int STATUS_DISABLED = ModelContextStatus.DISABLED;

            public const int STATUS_NORMAL = ModelContextStatus.NORMAL;

            public const int STATUS_DELETED = ModelContextStatus.DELETED;

            public const int REMOTE_SERVER = 0;

            public const int LOCAL_SERVER = 1;

     

            private static ModelContainer modelContext = null;

     

     

            /// <summary>

            /// Return current entity framework context, if the connection has not open

            /// yet, it will create the connection to database.

            /// </summary>

            public static ModelContainer Container

            {

                get

                {

                    if (modelContext == null)

                    {

                        modelContext = new ModelContainer();

                      

                        if (modelContext.Connection.State != System.Data.ConnectionState.Open)

                        {

                            modelContext.Connection.Open();

                        }

                    }

                    return modelContext;

                }

            }

        }

    }

  • 相关阅读:
    mysql使用命令备份和导入导出数据
    jmeter中json提取器提取多个参数给下游接口传参
    jmeter使用正则提取器返回多个参数给下游接口入参使用
    linux下分布式部署jmeter
    使用java远程启动jmeter服务报错,报错内容:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
    Java中看今天是星期几,礼拜几
    java读取xml文件的四种方法
    Oracle 恢复删除的表
    重启Oracle命令
    Android 资源
  • 原文地址:https://www.cnblogs.com/quietwalk/p/2136033.html
Copyright © 2011-2022 走看看