- 浏览: 87552 次
- 性别:
- 来自: 厦门
最新评论
-
zhengyong7232:
SELECT t.province,DECODE(landsc ...
列转行 -
meepo3927:
不是特么很懂
列转行
一.简介
IbatisNet一下简称Ibatis包括DataAccess和DataMapper两部分。整个Solution包括三个主项目:
IBatisNet.Common
IBatisNet.DataAccess
IBatisNet.DataMapper
和一个辅助项目:IBatisNet.Common.Logging.Log4Net。
Common项目是DataAccess和DataMapper的公共基础,提供通用功能和公共服务。DataAccess是DAO框架,DataMapper是SqlMap映射框架。Common.Logging.Log4Net是对log4net日志服务的代理,利用log4net日志框架产生和输出日志。
二.各项目介绍
Commons
根目录:
DataSource类封装了数据源信息,包括数据源的标志名Name,数据源的提供者Provider和数据源所代表的连接字符串ConnectionString。DataSource类有下列属性:
[Serializable]
[XmlRoot("dataSource", Namespace="http://ibatis.apache.org/dataMapper")]
类中的Property(属性)也有[XmlAttribute]属性(Attribute),例如public string ConnectionString属性有[XmlAttribute("connectionString")]。
所以类可被反序列化为xml文件,也可以直接通过XmlNode解析为对象。DataSourceDeSerializer类就是从XmlNode中读取信息并生成DataSource类。
DataSource属性和配置文件中的dataSource节点对应。
Provider类封装了data provider(数据提供者)信息,例如程序集名称AssemblyName,是否是默认提供者IsDefault,ConnectionClass,DataAdapterClass等提供者程序的信息。并提供了IDbCommand GetCommand(),IDbDataAdapter GetDataAdapter()等方法,为上层应用隐藏了具体驱动(数据提供程序)的细节。与DataSource一样Provider也是可以序列化为xml文件,并通过ProviderDeSerializer.cs中的ProviderDeSerializer类从XmlNode中构造Provider实例。
IDalSession类是Ibatis中的基础接口。封装了数据访问相关的会话信息,比如数据源,连接和事物对象。用于管理数据源相关信息,比如:
IDbCommand CreateCommand(CommandType commandType);
///
/// Create an IDataParameter
///
/// An IDataParameter.
IDataParameter CreateDataParameter();
///
/// Create a DataAdapter
///
///
/// used to select records in the data source.
/// An IDbDataAdapter.
IDbDataAdapter CreateDataAdapter(IDbCommand command);
///
/// Create a DataAdapter
///
/// An IDbDataAdapter.
IDbDataAdapter CreateDataAdapter();
连接管理的相关方法,比如:
///
/// Open a connection.
///
void OpenConnection();
///
/// Open a connection, on the specified connection string.
///
///
void OpenConnection(string connectionString);
///
/// close a connection
///
void CloseConnection();
事务管理相关的方法,比如:
///
/// Begins a transaction on the current connection
/// with the specified IsolationLevel value.
///
///
///
void BeginTransaction(bool openConnection, IsolationLevel isolationLevel);
///
/// Commit a transaction and close the associated connection
///
void CommitTransaction();
///
/// Commits the database transaction.
///
///
void CommitTransaction(bool closeConnection);
///
/// Rollbak a transaction and close the associated connection
///
void RollBackTransaction();
///
/// Rolls back a transaction from a pending state.
///
///
void RollBackTransaction(bool closeConnection);
等。
Exception目录:
Exception目录中的类定义了框架的异常类型。
IBatisNetException是框架基础类,其他框架异常都继承自它。
ConfigurationException类用于处理配置过程中出现的异常。
ForeignKeyException类用于代表外键异常和错误。
ProbeException类代表较表层的异常,通过该异常可以探究深层原因,也用于通过流节序列化并组装成异常实例的过程(不是太清楚)。框架中在ReflectionInfo和ObjectProbe中有使用。
Logging目录:
Logging目录类似于apache jarkata中的commons log,对log进行了封装,可以同时支持多种log实现,并通过配置文件进行配置。不详细说明。
Pagination目录:
Pagination目录辅助查询分类。
PaginatedArrayList类实现了IPaginatedList接口。用于维护页码和页中的数据内容。维护分页状态实现分页算法。PaginatedArrayList和具体的数据访问无关,内部通过ArrayList容器分类。
Transaction目录:
Transaction目录中的类用于事务管理。
IsolationLevel枚举定义了事务的隔离级别。
TransactionOptions结构指明了事务行为:事务时间段和隔离级别。
TransactionScopeOptions枚举描述了事务范围(Transaction scope)和事务的关联关系。
TransactionScope用于管理分布式事务,不过只支持1.1而且对操作系统由要求,不支持win2000。
Utilities目录:
Utilities目录中是一些公用类。
ConfigWatcherHandler类用于监视配置文件以便在配置文件修改的时候进行相应的处理,比如重新加载并处理配置文件。该类中注意Timer类和FileSystemWatcher类的用法。
DBHelperParameterCache类用于对存储过程参数的缓存。
HashCodeProvider类的public static int GetIdentityHashCode(object obj)方法返回obj的HashCode。
Resources类用于简化资源文件的访问。可以通过流,文件和url获取资源文件,并解析为XmlDocument。
ScriptRunner类用于执行sql脚本语句。
StringTokenizer类类似于java中的StringTokenizer,可以分割字符串为字符串数组。
Utilities/Objects目录:
Utilities/Objects目录下的类主要用于反射。
ObjectProbe由于获取对象的反射信息和运行时值信息。
ReflectionInfo主要缓存了类的定义信息,可以使property和get/set方法的映射更加简单。
Utilities/Proxy目录:
Utilities/Proxy目录利用Castle DynamicProxy的代理类。
CachedProxyGenerator继承自Castle DynamicProxy的ProxyGenerator,通过CreateProxy方法利用ProxyBuilder.CreateInterfaceProxy(interfaces, targetType )创建动态代理。
IProxyGenerator一个标志接口。
ProxyGeneratorFactory工厂类,获取Castle DynamicProxy的一个ProxyGenerator实例。
Utilities/TypesResolver目录:
Utilities/TypesResolver目录中的类用于类型解析。也就是利用反射和程序集从字符串构造出相应的类型。
TypeResolver的Type Resolve (string typeName)方法从程序集中获取类型信息。
CachedTypeResolver继承自TypeResolver,增加了缓存功能。
TypeAliasResolver类定义了Ibatis内部的别名和实际类型的映射,例如list-〉new ArrayList(),以及将系统的内置值类型变换为相应的对象类型。
Xml目录:
Xml目录包含一个NodeUtils类,主要用于从XmlNode中解析属性,和从NameValueCollection中获取值,ParsePropertyTokens(string str, NameValueCollection properties) 方法用于将str中的占位符用相应的properties中的值替代。str中可以有多个占位符属性。
IbatisNet一下简称Ibatis包括DataAccess和DataMapper两部分。整个Solution包括三个主项目:
IBatisNet.Common
IBatisNet.DataAccess
IBatisNet.DataMapper
和一个辅助项目:IBatisNet.Common.Logging.Log4Net。
Common项目是DataAccess和DataMapper的公共基础,提供通用功能和公共服务。DataAccess是DAO框架,DataMapper是SqlMap映射框架。Common.Logging.Log4Net是对log4net日志服务的代理,利用log4net日志框架产生和输出日志。
二.各项目介绍
Commons
根目录:
DataSource类封装了数据源信息,包括数据源的标志名Name,数据源的提供者Provider和数据源所代表的连接字符串ConnectionString。DataSource类有下列属性:
[Serializable]
[XmlRoot("dataSource", Namespace="http://ibatis.apache.org/dataMapper")]
类中的Property(属性)也有[XmlAttribute]属性(Attribute),例如public string ConnectionString属性有[XmlAttribute("connectionString")]。
所以类可被反序列化为xml文件,也可以直接通过XmlNode解析为对象。DataSourceDeSerializer类就是从XmlNode中读取信息并生成DataSource类。
DataSource属性和配置文件中的dataSource节点对应。
Provider类封装了data provider(数据提供者)信息,例如程序集名称AssemblyName,是否是默认提供者IsDefault,ConnectionClass,DataAdapterClass等提供者程序的信息。并提供了IDbCommand GetCommand(),IDbDataAdapter GetDataAdapter()等方法,为上层应用隐藏了具体驱动(数据提供程序)的细节。与DataSource一样Provider也是可以序列化为xml文件,并通过ProviderDeSerializer.cs中的ProviderDeSerializer类从XmlNode中构造Provider实例。
IDalSession类是Ibatis中的基础接口。封装了数据访问相关的会话信息,比如数据源,连接和事物对象。用于管理数据源相关信息,比如:
IDbCommand CreateCommand(CommandType commandType);
///
/// Create an IDataParameter
///
/// An IDataParameter.
IDataParameter CreateDataParameter();
///
/// Create a DataAdapter
///
///
/// used to select records in the data source.
/// An IDbDataAdapter.
IDbDataAdapter CreateDataAdapter(IDbCommand command);
///
/// Create a DataAdapter
///
/// An IDbDataAdapter.
IDbDataAdapter CreateDataAdapter();
连接管理的相关方法,比如:
///
/// Open a connection.
///
void OpenConnection();
///
/// Open a connection, on the specified connection string.
///
///
void OpenConnection(string connectionString);
///
/// close a connection
///
void CloseConnection();
事务管理相关的方法,比如:
///
/// Begins a transaction on the current connection
/// with the specified IsolationLevel value.
///
///
///
void BeginTransaction(bool openConnection, IsolationLevel isolationLevel);
///
/// Commit a transaction and close the associated connection
///
void CommitTransaction();
///
/// Commits the database transaction.
///
///
void CommitTransaction(bool closeConnection);
///
/// Rollbak a transaction and close the associated connection
///
void RollBackTransaction();
///
/// Rolls back a transaction from a pending state.
///
///
void RollBackTransaction(bool closeConnection);
等。
Exception目录:
Exception目录中的类定义了框架的异常类型。
IBatisNetException是框架基础类,其他框架异常都继承自它。
ConfigurationException类用于处理配置过程中出现的异常。
ForeignKeyException类用于代表外键异常和错误。
ProbeException类代表较表层的异常,通过该异常可以探究深层原因,也用于通过流节序列化并组装成异常实例的过程(不是太清楚)。框架中在ReflectionInfo和ObjectProbe中有使用。
Logging目录:
Logging目录类似于apache jarkata中的commons log,对log进行了封装,可以同时支持多种log实现,并通过配置文件进行配置。不详细说明。
Pagination目录:
Pagination目录辅助查询分类。
PaginatedArrayList类实现了IPaginatedList接口。用于维护页码和页中的数据内容。维护分页状态实现分页算法。PaginatedArrayList和具体的数据访问无关,内部通过ArrayList容器分类。
Transaction目录:
Transaction目录中的类用于事务管理。
IsolationLevel枚举定义了事务的隔离级别。
TransactionOptions结构指明了事务行为:事务时间段和隔离级别。
TransactionScopeOptions枚举描述了事务范围(Transaction scope)和事务的关联关系。
TransactionScope用于管理分布式事务,不过只支持1.1而且对操作系统由要求,不支持win2000。
Utilities目录:
Utilities目录中是一些公用类。
ConfigWatcherHandler类用于监视配置文件以便在配置文件修改的时候进行相应的处理,比如重新加载并处理配置文件。该类中注意Timer类和FileSystemWatcher类的用法。
DBHelperParameterCache类用于对存储过程参数的缓存。
HashCodeProvider类的public static int GetIdentityHashCode(object obj)方法返回obj的HashCode。
Resources类用于简化资源文件的访问。可以通过流,文件和url获取资源文件,并解析为XmlDocument。
ScriptRunner类用于执行sql脚本语句。
StringTokenizer类类似于java中的StringTokenizer,可以分割字符串为字符串数组。
Utilities/Objects目录:
Utilities/Objects目录下的类主要用于反射。
ObjectProbe由于获取对象的反射信息和运行时值信息。
ReflectionInfo主要缓存了类的定义信息,可以使property和get/set方法的映射更加简单。
Utilities/Proxy目录:
Utilities/Proxy目录利用Castle DynamicProxy的代理类。
CachedProxyGenerator继承自Castle DynamicProxy的ProxyGenerator,通过CreateProxy方法利用ProxyBuilder.CreateInterfaceProxy(interfaces, targetType )创建动态代理。
IProxyGenerator一个标志接口。
ProxyGeneratorFactory工厂类,获取Castle DynamicProxy的一个ProxyGenerator实例。
Utilities/TypesResolver目录:
Utilities/TypesResolver目录中的类用于类型解析。也就是利用反射和程序集从字符串构造出相应的类型。
TypeResolver的Type Resolve (string typeName)方法从程序集中获取类型信息。
CachedTypeResolver继承自TypeResolver,增加了缓存功能。
TypeAliasResolver类定义了Ibatis内部的别名和实际类型的映射,例如list-〉new ArrayList(),以及将系统的内置值类型变换为相应的对象类型。
Xml目录:
Xml目录包含一个NodeUtils类,主要用于从XmlNode中解析属性,和从NameValueCollection中获取值,ParsePropertyTokens(string str, NameValueCollection properties) 方法用于将str中的占位符用相应的properties中的值替代。str中可以有多个占位符属性。
发表评论
-
最小生成树之Kruskal算法
2013-12-15 00:54 1064这篇文章实现最小生成树的Kruskal算法Kruskal算 ... -
排序算法--插入排序
2013-12-15 00:47 1037插入排序原理:假设 ... -
poi创建下拉框
2013-04-16 19:01 0package finance.tools.salesper ... -
Spring中Transactional配置
2013-04-11 20:43 977Spring中Transactional配置 标签: 杂谈 分 ... -
Hibernate将Enum枚举类型映射为Int类型 .
2013-04-09 16:46 1505最近要用Hibernate做一个枚举类型的映射,在MySQL ... -
Hibernate 更灵活的用法 HibernateCallback
2013-01-22 14:41 1392在项目中用Hibernate的DetachedCriter ... -
spring源代码分析(2)--BeanFactory
2013-01-20 12:38 1386我们首先来看下BeanFacroty接口 pa ... -
spring源代码分析(1)--Resource的分析
2013-01-20 12:22 4006我们知道,在spring中,配置文件是通过资源形式加载的, ... -
DefaultListableBeanFactory研究
2013-01-18 10:49 5876DefaultSingletonBeanRegistry完 ... -
jvm的内存调优
2013-01-11 15:54 8301) 堆 运行时数 ... -
struts2中Action的name 和package的name和namespace是什么作用
2013-01-02 12:16 9601在struts2的 struts.xml 配置中 例: ... -
深入探索 高效的Java异常处理框架
2012-10-22 14:09 879摘要:本文从Java异常最基本的概念、语法开始讲述了Java异 ... -
JAVA对ArrayList排序
2012-10-16 21:53 16484java如何对ArrayList中对象按照该对象某属性排序 ... -
ThreadPoolExecutor使用和思考(中)-keepAliveTime及拒绝策略
2012-09-11 00:48 929工作中多处接触到了ThreadPoolExecutor。趁着现 ... -
ThreadPoolExecutor使用和思考(上)-线程池大小设置与BlockingQueue的三种实现区别
2012-09-11 00:45 1618工作中多处接触到了ThreadPoolExecutor。趁着现 ... -
Spring IOC之BeanFactory
2012-09-10 12:39 1282BeanFactory ,作为 Spring 基础的 IoC ... -
Java5 并发学习
2012-09-10 11:33 794在Java5之后 ... -
Spring对事务管理的支持的发展历程(基础篇
2012-08-31 17:43 912Connection conn = DataS ... -
CXF ,在Client端用于把 Date 类型转换成 XMLGregorianCalendar .
2012-08-31 16:54 1622import javax.xml.datatype.Datat ... -
《Spring技术内幕》学习笔记10——Web环境中Spring的启动过程
2012-07-30 09:04 9801.Spring 不但可以在 JavaSE 环境中应用,在 W ...
相关推荐
apache开源项目源码ibatis-3-core-src-3.0.0.227 ibatis框架java源程序 spring,struts,hibernate,ibatis,框架源码 各种ibatis框架应用源码,你会从中得到意想不到的效果! apache开源组织开发的开源项目源码,其...
ibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zip
ibatis-3-core-3.0.0.200
ibatis-3-core-3.0.0.242.zip ibatis-3-core-3.0.0.242.zip ibatis-3-core-3.0.0.242.zip ibatis-3-core-3.0.0.242.zip
ibatis-common-2.jar...........
ibatis-dao-2.jar gggggggggggg
ibatis-sqlmap-2.jar 对数据库进行操作的jar包 很方便使用
ibatis-sqlmap ibatis-sqlmap-2 ibatis-sqlmap-2.jar.zip
ibatis-core-3.0.jar 找了半天,终于找到了,很好的解决了我的问题,给所需要之人!~
ibatis-3-core-3.0.0.204 最新官方下载版
iBATIS-DAO-2.pdf
IBatis-SQL-MAPs 开发指南IBatis-SQL-MAPs 开发指南IBatis-SQL-MAPs 开发指南IBatis-SQL-MAPs 开发指南IBatis-SQL-MAPs 开发指南
Ibatis基本配置---[环境搭建
ibatis缓存介绍 - 勇泽 - 博客园ibatis缓存介绍 - 勇泽 - 博客园ibatis缓存介绍 - 勇泽 - 博客园ibatis缓存介绍 - 勇泽 - 博客园
ibatis-sqlmap-2.3.0中sqlmap支持通配符
jar包ssi,ssh需要的jar包,hibernate3.jar、ibatis-dao-2.jar、spring.jar、struts.jar、log4j-1.2.9.jar
ibatic框架最新驱动--------------------
搭建mybatis所需包org.apache.ibatis.annotations.Param @Param