ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samnang Chhun <samnang.ch...@gmail.com>
Subject RE: internal constructor problem
Date Tue, 24 Jul 2007 10:25:09 GMT
Hi Rusty,

I have understood about Tony's advice, but it's different from my project
because my problem is internal constructor in public class, not internal
class. I think maybe iBatis only look for public constructor in class.

Cheers,

Samnang

 

 

From: Rusty Wright [mailto:rusty.wright@gmail.com] 
Sent: Tuesday, July 24, 2007 10:31 AM
To: Samnang Chhun
Cc: rusty@berkeley.edu; user-cs@ibatis.apache.org
Subject: Re: internal constructor problem

 

Sorry, my computer at work died so I can't look at my code to see how I did
it, but I remember following his instructions closely; i.e., where he says

[assembly: InternalsVisibleTo("My.Test.Assembly")]
 

I replaced My.Test.Assembly with the name of my namespace of my test
assembly. I'm thinking that what may be tricky for you is figuring out which
namespace to use in the InternalVisibleTo.


Samnang Chhun wrote: 

If I change my constructor to public, it's test ok, but I don't want to this
constructor to public because the client side can access it.

 

From: Rusty Wright [mailto:rusty.wright@gmail.com] 
Sent: Monday, July 23, 2007 1:44 PM
To: Samnang Chhun
Cc: user-cs@ibatis.apache.org; rusty@berkeley.edu
Subject: Re: internal constructor problem

 

What happens if you change the constructor to public?

The error I received with my problem said something about not being able to
access an
internal class, and I received the error during compilation.

Samnang Chhun wrote: 

Hi Rusty,

 

I couldn't get clearly understand on Tony's advice, could you explain me
more detail about this. I have 3 projects separately Yolk.DTO,
Yolk.Data.iBatis, and UnitTest.

I let Yolk.Data.iBatis can access to my internal constructor of my classes
in Yolk.DTO, so I add [assembly: InternalVisibleTo("Yolk.Data.iBatis, Public
Key=.") to assemblyinfo.cs in my Yolk.DTO.

How can I access to internal constructor in sqlMap of iBatis.Net? But I can
access to internal properties. What have I done something wrong?

When I execute my testing I got an error:

 

IBatisNet.Common.Exceptions.ConfigurationException: 
- The error occurred while loading SqlMap.
- Argument property (id) set the typeHandler attribute.
- The error occurred in <sqlMap embedded="Maps.Agreement.xml,
Yolk.Data.iBatis" xmlns= <http://ibatis.apache.org/dataMapper>
"http://ibatis.apache.org/dataMapper" />.  
- Check the Agreement.agreementResult.


at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao) 
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Configure(XmlDocument
document) 
at Yolk.Data.iBatis.DirectoryMapper.InitMapper() in DirectoryMapper.cs:line
<cref://210B6FE1-9FD6-4DB5-97E1-DF93C954004C/d:Core/f:DirectoryMapper.cs*34*
1>  34 
at Yolk.Data.iBatis.DirectoryMapper.Instance() in DirectoryMapper.cs:line
<cref://210B6FE1-9FD6-4DB5-97E1-DF93C954004C/d:Core/f:DirectoryMapper.cs*50*
1>  50 
at Yolk.Data.iBatis.AgreementRepository.GetNextAgreementId() in
AgreementRepository.cs:line
<cref://210B6FE1-9FD6-4DB5-97E1-DF93C954004C/f:AgreementRepository.cs*19*1>
19 
at UnitTests.AgreementRepositoryTest.GetNextAgreementId() in
AgreementRepositoryTest.cs:line
<cref://32617940-B547-4303-9746-A97F8F86F69E/f:AgreementRepositoryTest.cs*17
*1>  17 

IBatisNet.Common.Exceptions.ConfigurationException: Could not configure
ResultMap named "Agreement.agreementResult", Cause: Unable to optimize
create instance. Cause : Could not find public constructor matching
specified arguments for type "Agreement".

 

Cheers,

Samnang

 

 

From: Rusty Wright [mailto:rusty.wright@gmail.com] 
Sent: Saturday, July 21, 2007 1:54 AM
To: user-cs@ibatis.apache.org
Subject: Re: internal constructor problem

 

I had a similar problem with unit tests; see the reply from Tony Bjerstedt
below.


-------- Original Message -------- 


Subject: 

Re: [Nunit-users] name spaces?


Date: 

Tue, 17 Jul 2007 18:41:24 -0700


From: 

Charlie Poole  <mailto:charlie@pooleconsulting.com>
<charlie@pooleconsulting.com>


To: 

 <mailto:nunit-users@lists.sourceforge.net>
<nunit-users@lists.sourceforge.net>

 

Hi Rusty, 
 
Tony's advice is good, assuming you are using Visual Studio 2005.
 
Note that it's only the use of a separate assembly, not a different
namespace that is causing the problem. You can have different namespaces
in a single assembly or one namespace across multiple assemblies.
 
You handle assembly visibility with references. Namespace visibility
with using (VB=imports) statements.
 
Charlie
 
> -----Original Message-----
> From: nunit-users-bounces@lists.sourceforge.net 
> [mailto:nunit-users-bounces@lists.sourceforge.net] On Behalf 
> Of Rusty Wright
> Sent: Tuesday, July 17, 2007 11:20 AM
> To: Tony.Bjerstedt@audatex.com
> Cc: nunit-users@lists.sourceforge.net
> Subject: Re: [Nunit-users] name spaces?
> 
> Great, sounds like just what I need.  Thanks.
> 
> Tony.Bjerstedt@audatex.com wrote:
> > If your tests are in a different assembly, they no longer 
> can see any 
> > of the classes that they test. Internal scope only allows other 
> > classes in the same assembly to have access to the internal scoped 
> > classes and members. You can extend internal visibility to other 
> > assemblies using the "InternalsVisibleTo" attribute.
> >
> > Add a statement like:
> >     [assembly: InternalsVisibleTo("My.Test.Assembly")]
> > To you "assemblyinfo.cs" file.
> >
> >
> > -----Original Message-----
> > From: nunit-users-bounces@lists.sourceforge.net
> > [mailto:nunit-users-bounces@lists.sourceforge.net] On 
> Behalf Of Rusty 
> > Wright
> > Sent: Tuesday, July 17, 2007 12:29 PM
> > To: nunit-users@lists.sourceforge.net
> > Subject: [Nunit-users] name spaces?
> >
> > How do people manage their name spaces with NUnit?  I have 
> a class in 
> > the namespace ShopsiteOrderApi that I'm testing and my unit 
> tests are 
> > in
> >
> > the namespace Tests.  I tried changing the class in the 
> > ShopsiteOrderApi
> >
> > from public to internal but now the test won't compile.
> >
> > 
> ----------------------------------------------------------------------
> > --
> > -
> > This SF.net email is sponsored by DB2 Express Download DB2 
> Express C - 
> > the FREE version of DB2 express and take control of your XML. No 
> > limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Nunit-users mailing list
> > Nunit-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nunit-users
> >   
> 
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by DB2 Express Download DB2 
> Express C - the FREE version of DB2 express and take control 
> of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Nunit-users mailing list
> Nunit-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nunit-users
> 
 
 
 
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Nunit-users mailing list
Nunit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nunit-users
 

 

 


Mime
View raw message