ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nguyen, Tom" <Tom.Ngu...@rels.info>
Subject RE: sqlMap Configuration Issue
Date Sun, 20 May 2007 05:30:36 GMT
Ok, unless someone knows another way, the only way I know is to use
assembly (.dll) references.  Even .net references assembly this way,
unless you GAC it which will require you to put in into a dll anyway.
IE.  .net 2.0 automatically add the assembly reference to web.config
file.

 

In ASP.NET 2.0, compilation generates random assembly.  This is really
annoying during deployment that is why there is an option in right-click
web project menu -> "Publish Web Site" called "use fixed naming and
single paged assembly.  Using this option, all cs files under "App_Code"
will compile into App_Code.dll

 

Another option is to use the new Web Project.  Asp.NET 2.0 web project
is an additional download that includes ilmerge.  It will merge all
compiled dll into an assembly name of your choice eg: company.web.dll
etc...

 

This is what you will use in your ibatisnet typeAlias defintion.

 

Regards,


Tom Nguyen 
Sr. Developer
tom.nguyen@rels.info <mailto:tom.nguyen@rels.info> 



________________________________

From: Ryan MacDonald [mailto:ryan@ryanmacdonald.net] 
Sent: Friday, May 18, 2007 2:11 PM
To: user-cs@ibatis.apache.org
Subject: RE: sqlMap Configuration Issue

 

That's alright. I appreciate it.

 

~Ryan

 

From: Clough, Samuel (USPC.PRG.Atlanta)
[mailto:Samuel_Clough@princetonrg.com] 
Sent: Friday, May 18, 2007 3:08 PM
To: user-cs@ibatis.apache.org
Subject: RE: sqlMap Configuration Issue

 

Sorry, I missed that.  I'll have to let some other experts answer that.
We've only used iBatis with business layers that were in their own
assemblies.

 

________________________________

From: Ryan MacDonald [mailto:ryan@ryanmacdonald.net] 
Sent: Friday, May 18, 2007 3:06 PM
To: user-cs@ibatis.apache.org
Subject: RE: sqlMap Configuration Issue

Ok, do I have to use a precompiled assembly (.dll)? Right now I'm just
trying to use a .cs file in my app_code folder and it gets compiled at
runtime. Can I do it that way or do I need to compile it first?

 

~Ryan

 

From: Clough, Samuel (USPC.PRG.Atlanta)
[mailto:Samuel_Clough@princetonrg.com] 
Sent: Friday, May 18, 2007 3:03 PM
To: user-cs@ibatis.apache.org
Subject: RE: sqlMap Configuration Issue

 

Where you specify your class, put a comma after the name of the class
and then the name of your assembly minus the .dll extension.  Also, to
make your life easier you could use an alias at the top of your mapping
file so that you can give the type a name and then only have one place
that lists the full name and the assembly name.

 

________________________________

From: Ryan MacDonald [mailto:ryan@ryanmacdonald.net] 
Sent: Friday, May 18, 2007 2:57 PM
To: user-cs@ibatis.apache.org
Subject: sqlMap Configuration Issue

I'm new to Ibatis.net and am still trying to get my first app working
with it. I'm running into the problem when my sqlMap is configured at
runtime. It can't seem to find my assembly with my class definitions.
The assembly is in my App_Code folder and is called "Newbydev.User"
which contains the class definition for a UserBasic. Any help is greatly
appreciated. Here's the error I'm getting:

 

Could not load type from string value 'User.UserBasic'. 

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code. 

Exception Details: System.TypeLoadException: Could not load type from
string value 'User.UserBasic'.

Source Error: 

 

Line 52:     private void cmdLogin_Click(Object sender, EventArgs e)

Line 53:     {

Line 54:         User.UserServices.Authenticate(txtUser.Text,
txtPass.Text);

Line 55:     }

Line 56: }


Source File:
d:\webspace\newbydevcom\newbydev.com\www\MasterPage.master.cs    Line:
54 

Stack Trace: 

 

[TypeLoadException: Could not load type from string value
'User.UserBasic'.]

 
IBatisNet.Common.Utilities.TypesResolver.TypeResolver.ResolveType(String
typeName) +242

   IBatisNet.Common.Utilities.TypesResolver.TypeResolver.Resolve(String
typeName) +29

 
IBatisNet.Common.Utilities.TypesResolver.CachedTypeResolver.Resolve(Stri
ng typeName) +135

   IBatisNet.Common.Utilities.TypeUtils.ResolveType(String typeName) +28

 
IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.Initialize(Co
nfigurationScope configScope) +62

 

[ConfigurationException: Could not configure ResultMap named
"User.userBasicResult", Cause: Could not load type from string value
'User.UserBasic'.]

 
IBatisNet.DataMapper.Configuration.ResultMapping.ResultMap.Initialize(Co
nfigurationScope configScope) +292

 
IBatisNet.DataMapper.Configuration.Serializers.ResultMapDeSerializer.Des
erialize(XmlNode node, ConfigurationScope configScope) +129

   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.BuildResultMap()
+134

   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
+1283

   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
+5041

   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao) +239

 

[ConfigurationException: 

- The error occurred while Validate SqlMap config.

- initialize ResultMap

- The error occurred in <sqlMap resource="${datamaps}/User.xml"
xmlns="http://ibatis.apache.org/dataMapper" />.  

- Check the User.userBasicResult.]

   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao) +293

 
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(St
ring resource, ConfigureHandler configureDelegate) +181

   IBatisNet.DataMapper.Mapper.InitMapper() +71

   IBatisNet.DataMapper.Mapper.Instance() +62

   Newbydev.UserServices.GetUserBasicByLogin(String Login) +29

   Newbydev.UserServices.Authenticate(String username, String password)
+56

   MasterPage.cmdLogin_Click(Object sender, EventArgs e) in
d:\webspace\newbydevcom\newbydev.com\www\MasterPage.master.cs:54

   System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
+105

   System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
eventArgument) +115

 
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandle
r.RaisePostBackEvent(String eventArgument) +7

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33

   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+5102

 

And this is part of my my sqlMap.xml file

 

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

 

<sqlMap namespace="User"

xmlns="http://ibatis.apache.org/mapping"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

 

  <resultMaps>

    <resultMap id="userBasicResult" class="Newbydev.User.UserBasic" >

      <result property="ID"            column="user_ID" />

      <result property="FirstName"     column="user_FName" />

      <result property="LastName"      column="user_Lname" />

      <result property="Login"         column="user_Login" />

      <result property="Password"      column="user_Password" />

      <result property="IsAdmin"       column="user_IsAdmin" />

      <result property="TryCount"      column="user_TryCount" />

      <result property="LastAttempt"   column="user_LastAttempt" />

    </resultMap>

  </resultMaps>

 

  <statements>

    <select id="selectUserBasic"
parameterClass="Newbydev.User.UserBasic" resultMap="userBasicResult"
cacheModel="userCache">

      SELECT

      U.user_ID,

      U.user_FName,

      U.user_Lname,

      U.user_Login,

      U.user_Password,

      U.user_IsAdmin,

      U.user_TryCount,

      U.user_LastAttempt

      FROM

      tbl_User U

      <dynamic prepend="WHERE">

        <isNotNull property="ID">

          U.user_ID = #ID#

        </isNotNull>

        <isNotEmpty property="Login">

          U.user_Login = #Login#

        </isNotEmpty>

      </dynamic>

    </select>

  </statements>

 

</sqlMap>

________________________________

Princeton Retirement Group, Inc - Important Terms 

This E-mail is not intended for distribution to, or use by, any person
or entity in any location where such distribution or use would be
contrary to law or regulation, or which would subject Princeton
Retirement Group, Inc. or any affiliate to any registration requirement
within such location. 

This E-mail may contain privileged or confidential information or may
otherwise be protected by work product immunity or other legal rules. No
confidentiality or privilege is waived or lost by any mistransmission.
Access, copying or re-use of information by non-intended or
non-authorized recipients is prohibited. If you are not an intended
recipient of this E-mail, please notify the sender, delete it and do not
read, act upon, print, disclose, copy, retain or redistribute any
portion of this E-mail. 

The transmission and content of this E-mail cannot be guaranteed to be
secure or error-free. Therefore, we cannot represent that the
information in this E-mail is complete, accurate, uncorrupted, timely or
free of viruses, and Princeton Retirement Group, Inc. cannot accept any
liability for E-mails that have been altered in the course of delivery.
Princeton Retirement Group, Inc. reserves the right to monitor, review
and retain all electronic communications, including E-mail, traveling
through its networks and systems (subject to and in accordance with
local laws). If any of your details are incorrect or if you no longer
wish to receive mailings such as this by E-mail please contact the
sender by reply E-mail. 

________________________________


************************************************************************************
This e-mail message and any files transmitted herewith, are intended solely for the
use of the individual(s) addressed and may contain confidential, proprietary or 
privileged information.  If you are not the addressee indicated in this message 
(or responsible for delivery of this message to such person) you may not review, 
use, disclose or distribute this message or any files transmitted herewith.  If you 
receive this message in error, please contact the sender by reply e-mail and delete
this message and all copies of it from your system.
************************************************************************************

Mime
View raw message