You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Samnang Chhun <sa...@gmail.com> on 2007/07/20 04:38:20 UTC

Internal constructor problem

Hi all,

I'm just getting to work with iBatis.Net in my C# project, but I have a
problem with internal constructor. My class has an internal constructor that
doesn't want client side to access this constructor and has another
constructor for client side. In my ResultMap, why can't I call internal
constructor in my ResultMap, but I can map internal property in my
ResultMap. What have I done something wrong with constructor? Does
iBatis.net support this feature?

 

I have a class:

public class Person

{

      internal int _id;

      internal string _name;

      private bool _isNew;

      public Person()

      {

            _isNew = true;

}

internal Person(int id)

      {

            _id = id;

}

.

}

 

<resultMaps>

    <resultMap id="PersonResult" class="Person">

        <constructor>

                  <argument argumentName="id" column="PersonId" />

        </constructor>

        <result property="_name" column="name" />

    </resultMap>

  </resultMaps>

  <statements>

    <select id="SelectAllPerson" resultMap="PersonResult">

      SELECT PersonId, name FROM Person

    </select>

  </statements>

 

I hope to hear from you soon.

 

Regards,

Samnang