ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Rodrigues <jlmarc.rodrig...@gmail.com>
Subject What wrong : IBatisNet.Common.Exceptions.ConfigurationException:
Date Sat, 18 Feb 2006 06:22:54 GMT
Hi all,
I'am using this technical environment :


> Dot.Net 2.0
> MS SQL Server 2000 or 2005 same issues
> C# 2.0
> Visual Studio 2005

with this bin release of iBatis.net

IBatisNet.DataMapper.dll 1.2.1.0
IBatisNet.Common.dll 1.2.0.0

I would like to know what is wrong with my SqlMap file, i got this error 
message :

Test method NortWindTest.CustomerServiceTest.UpdateCustomerTest threw 
exception:  IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap .
- initialize type alias
- The error occurred in <sqlMap resource="${root}/CustomerHelper.xml" />. 
- Check the NortwindProject.Model.Customer, NortwindProject.Model. --->  
System.TypeLoadException: Could not load type : 
NortwindProject.Model.Customer, NortwindProject.Model.

Thanks,

Below you can find the class CustomerService, the test class 
CustomerServiesTest,  the error stack and all config files


using NortwindProject.Model;
using IBatisNet.DataMapper;

namespace NortwindProject.Services
{
    public class CustomerService
    {
        public Customer NewCustomer()
        {
            return new Customer();
        }

        public bool UpdateCustomer(Customer customer)
        {
            // get it
            SqlMapper m_Mapper = IBatisNet.DataMapper.Mapper.Instance();

            m_Mapper.Update("Update", customer); 
          
            return true;
        }
.......

[TestMethod()]
        public void UpdateCustomerTest()
        {
            CustomerService target = new CustomerService();

            Customer value = new Customer();
            value.CustomerID = "MONIC";
            value.CompagnyName = "Saga Groupe";
            value.ContactName = "Marc";

            bool expected = true;
            bool actual;

            actual = target.UpdateCustomer(value);

            Assert.AreEqual(expected, actual, 
"NortWindProject.Services.CustomerService.UpdateCustomer did not return 
the expec" +
                    "ted value.");
        }



Error Stack Trace :
 at IBatisNet.Common.Utilities.TypesResolver.TypeResolver.Resolve(String 
typeName)
   at 
IBatisNet.Common.Utilities.TypesResolver.CachedTypeResolver.Resolve(String 
typeName)
   at IBatisNet.Common.Utilities.Resources.TypeForName(String className)
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
   at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
   at 
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument 
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean 
isCallFromDao)
 --- End of inner exception stack trace ---
    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 NortwindProject.Services.CustomerService.UpdateCustomer(Customer 
customer) in G:\Dot.Net\NortWind 
project\NortWindProject\Services\CustomerService.cs:line 16
   at NortWindTest.CustomerServiceTest.UpdateCustomerTest() in 
G:\Dot.Net\NortWind 
project\NortWindProject\NortWindTest\CustomerServiceTest.cs:line 145


Here my sqlMap file "CustomerHelper.xml" :

<?xml version="1.0" encoding="utf-8" ?>

<sqlMap
    namespace="Customer"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="SqlMap.xsd">

    <!-- XML "behind" document for the People service class. -->

    <alias>
    <typeAlias alias="Customer" type="NortwindProject.Model.Customer, 
NortwindProject.Model" />
  </alias>
   
    <resultMaps>
        <resultMap id="SelectResult" class="Customer">
            <result property="CustomerID" column="CUSTOMERID" />
            <result property="CompagnyName" column="COMPAGNYNAME" />
            <result property="ContactName" column="CONTACTNAME" />
        </resultMap>
    </resultMaps>
   
    <statements>
   
        <select id="Select" parameterClass="int" resultMap="SelectResult">
      select
      CUSTOMERID,
      COMPAGNYNAME,
      CONTACTNAME
      from CUSTOMER
      <dynamic prepend="WHERE">
                <isParameterPresent>
          CUSTOMERID = #value#
        </isParameterPresent>
            </dynamic>
        </select>

        <insert id="Insert" parameterClass="Customer">
      insert into CUSTOMER
      (CUSTOMERID, COMPAGNYNAME, CONTACTNAME)
      values
      (#CustomerID#, #CompagnyName#, #ContactName#)
    </insert>

        <update id="Update" parameterClass="Customer">
      update CUSTOMER set
      COMPAGNYNAME = #CompagnyName#,
      CONTACTNAME = #ContactName#
      where CUSTOMERID = #CustomerID#
    </update>

    <delete id="Delete" parameterClass="int">
      delete from CUSTOMER
      where CUSTOMERID = #value#
    </delete>
   
    </statements>
   
</sqlMap>


and my sqlMap.config file

<?xml version="1.0" encoding="UTF-8" ?>
<sqlMapConfig
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">

    <properties resource="properties.config"/>

    <settings>
        <setting useStatementNamespaces="false"/>
        <setting cacheModelsEnabled="true"/>
    </settings>

    <providers resource="providers.config"/>

    <database>   
        <provider name="${provider}"/>
        <dataSource name="PUPPY-TOY"  
connectionString="${connectionString}"/>
    </database>

    <sqlMaps>
        <sqlMap resource="${root}CustomerHelper.xml" />
    </sqlMaps>

</sqlMapConfig>

and the properties file

<?xml version="1.0" encoding="utf-8" ?>
<settings>
    <!--   User application and configured property settings go here.-->
    <!--   Example: <add key="settingName" value="settingValue"/> -->
    <add key="provider" value="sqlServer1.1" />
    <add key="connectionString" value="Provider=Microsoft.Jet.OLEDB.4.0; 
database=Northwind; user ID = XX; password =XXXXX" />
    <add key="root" value="../../" />
</settings>










Mime
View raw message