Unforutnately I'm getting the following error and just can't put my finger on what is causing it.
UnitTests.DataTests.Find : System.TypeInitializationException : The type initializer for "Data.Dal.PaymentLog" threw an exception.
----> IBatisNet.Common.Exceptions.ConfigurationException :
- The error occurred while loading SqlMap.
- The error occurred in <sqlMap resource="${root}DataMaps/PaymentLog.xml" xmlns="http://ibatis.apache.org/dataMapper" />.
----> System.NullReferenceException : Object reference not set to an instance of an object.
Here is the stack trace:
at Data.Dal.PaymentLog.Find()
at UnitTests.DataTests.Find() in C:\VSProjects\ADDSIntegration\trunk\ADDSintegrationSolution\UnitTests\DataTests.cs:line 36
--TypeInitializationException
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(String resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Mapper.InitMapper()
at IBatisNet.DataMapper.Mapper.Instance()
at Data.Dal.PaymentLog..cctor() in c:\vsprojects\addsintegration\trunk\addsintegrationsolution\data\dal\paymentlog.cs:line 23
--ConfigurationException
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocumen t document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao)
The database being connected to is MySQL 5 using the .net Connector 1.0.7 (I've updated the properties.config with the new connector version number).
I've also stripped down my DataMap file to just including the property/field mappings and a single simple select with no parameters.
Any thoughts on what else I should check? My full config files are listed below.
properties.config
============
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<add key="provider" value="MySql" />
<add key="connectionString" value="Persist Security Info=False;Host=localhost;Protocol=tcp;Initial Catalog=AddsAudit;User Id=AddsAudit;password=password;" />
<add key="root" value="" />
</settings>
sqlmap.config
===========
<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<properties resource="properties.config"/>
<settings>
<setting useStatementNamespaces="false"/>
<setting cacheModelsEnabled="true"/>
</settings>
<database>
<provider name="${provider}"/>
<dataSource name="ADDSLocalDb" connectionString="${connectionString}"/>
</database>
<alias>
<typeAlias alias="PaymentLog" type="Data.Dal.PaymentLog, Data" />
</alias>
<sqlMaps>
<sqlMap resource="${root}DataMaps/PaymentLog.xml" />
</sqlMaps>
</sqlMapConfig>
PaymentLog.xml
=============
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="DAL">
<resultMaps>
<resultMap id="PaymentLogMap" class="PaymentLog">
<result property="AddsConfirmationNumber" column="AddsConfirmationNumber" />
<result property="Amount" column="Amount" />
<result property="EntryDateTime" column="EntryDateTime" />
<result property="FullAccountNumber" column="FullAccountNumber" />
<result property="Id" column="Id" />
<result property="PaymentServiceConfirmationNumber" column="PaymentServiceConfirmationNumber" />
<result property="ShortAccountNumber" column="ShortAccountNumber" />
</resultMap>
</resultMaps>
<statements>
<select id="SelectPaymentLog" resultMap="PaymentLogMap">
SELECT *
FROM PaymentLogs
</select>
</statements>
</sqlMap>
Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.

