My IbatisNet Practice

xiaoxiao2021-03-06  34

1. About IBATIS and Ibatisnet

Ibatis is another o / r mapping solution, J2EE's O / R scheme is much more, compared with Hibernate, the biggest feature of Ibatis

It is a small, it is very fast. If you don't need too much complex feature, iBATIS is the easiest solution that can meet your requirements and flexibly

Decision.

Ibatisnet is the .NET version of Ibatis.

The main station of Ibatis and Ibatisnet is www.ibatis.com

2. Download http://www.ibatis.com/common/download.html This is of course quoted by ibatisnet.common.dll, ibatisnet.dataMapper.dll, ibatisnet.dataAccess.dll, etc.

There are some database connection drivers in your project, in "NPETSHOP EXAMPLE"

You can find it in the directory "Source / External-Bin /" in an example of application.

Let's practice the first Ibatisnet item 1. Database: Use SQLServer2000: Creating Table in Northwind Test

CREATE TABLE [Person] ([PER_ID] [int] NOT NULL, [PER_FIRST_NAME] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL, [PER_LAST_NAME] [varchar] (40) COLLATE Chinese_PRC_CI_AS NOT NULL, [PER_BIRTH_DATE] [datetime] NOT NULL, [PER_WEIGHT_KG] [float] not null, [per_height_m] [float] not null)

2. Add a configuration file SQLMap.config (my understanding is: sqlmap.config is the configuration file read by the iBatisnet, temporarily don't know how to make ibatisn

ET read files to replace SQLMap.config)

xsi: noNamespaceSchemaLocation = "SqlMapConfig.xsd"> < Provider name = "sqlserver1.1">

Connectionstring = "Server = localhost; database = test; user ID = sa; password = 123; connection

RESET = false; connections Lifetime = 5; MIN pool size = 1; Max pool size = 50 "/> / / Defines a database connection method. I use it here to connect SQLServer2000, you can use the //providers.config file to configure the database connection method according to yourself, you can download the official provoders.config file, It's more longer, it's not posted.

3. Join the mapping file Person.xml

TYPE = "ibatistest.person" /> < result property = "HeightInMeters" column = "PER_HEIGHT_M" />

CopyRight © 2020 All Rights Reserved
Processed: 0.046, SQL: 9