zoukankan      html  css  js  c++  java
  • ibatis 基类生成

    using IBatisNet.Common.Utilities;
    using IBatisNet.DataMapper;
    using IBatisNet.DataMapper.Configuration;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using System.Threading.Tasks;
    namespace Dscf.Map
    {
        public class BaseBatis
        {
            public static ISqlMapper SqlMap; //SqlMap  sqlMap
            private static readonly object synobj = new object();
            static BaseBatis()
            {
                if (SqlMap == null)
                {
                    lock (synobj)
                    {
                        if (SqlMap == null)
                        {
                            Assembly assembly = Assembly.Load("Dscf.Map");
                            Stream stream = assembly.GetManifestResourceStream("Dscf.Map.sqlmap.config"); //TestMap.sqlmap.config
                            DomSqlMapBuilder builder = new DomSqlMapBuilder();//其作用是根据配置文件创建SqlMap实例。
                            try
                            {
                                SqlMap = builder.Configure(stream);
                            }
                            catch (Exception)
                            {
                                throw;
                            }
                        }
                    }
                }
            }
            //public static ISqlMapper SqlMap; //SqlMap  sqlMap
            //private static ISqlMapper _instance = null;
            ////private static Hashtable sqlMappers = new Hashtable();
            //public static ISqlMapper GetMapper()
            //{
            //    if (_instance == null)
            //    {
            //        //_instance = Mapper.Get();
            //        //_instance.SessionStore = new HybridWebThreadSessionStore(_instance.Id);
            //        ConfigureHandler handler = new ConfigureHandler(Configure);
            //        DomSqlMapBuilder builder = new DomSqlMapBuilder();
            //        _instance = builder.ConfigureAndWatch("bin\Dscf.Map\Config", Configure);
            //    }
            //    return _instance;
            //    //return Mapper.Get();
            //}
            //protected static void Configure(object obj)
            //{
            //    _instance = null;
            //}
        }
    }
  • 相关阅读:
    电脑磁盘分区助手:DiskGenius磁盘管理与数据恢复软件
    python安装第三方的包
    教你成为全栈工程师(Full Stack Developer) 四十五-一文读懂hadoop、hbase、hive、spark分布式系统架构
    北半球 自己动手做聊天机器人
    [08] 请求、会话、上下文属性比较
    [07] ServletContext上下文对象
    [06] Session实现机制以及和Cookie的区别
    [05] Session概要
    [04] Cookie概念和基本使用
    [03] Servlet继承关系和生命周期
  • 原文地址:https://www.cnblogs.com/dullbaby/p/4828473.html
Copyright © 2011-2022 走看看