Used Hybernate Version: 1.0.3.0
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="Omis.Core" namespace="Omis.Core.Domain">
<class name="TModules" table="t_Modules">
<id name="Modulid" column="ModulID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<bag name="TCustomerModulsList" inverse="true" lazy="true" >
<key column="ModulID" />
<one-to-many class="TCustomerModuls" />
</bag>
<bag name="TVisMaskList" inverse="true" lazy="true" >
<key column="ModulID" />
<one-to-many class="TVisMask" />
</bag>
<property column="Description" type="String" name="Description" length="30" />
</class>
</hibernate-mapping>
created Class File:
Code:
using System;
using System.Collections.Generic;
namespace Omis.Core.Domain
{
[Serializable]
public class TModules: IEquatable<TModules>
{
#region Private Members
private int _modulid;
private IList<TCustomerModuls> _TCustomerModulsList;
private IList<TVisMask> _TVisMaskList;
private string _description;
#endregion
#region Constructor
public TModules()
{
_modulid = 0;
_TCustomerModulsList = new List<TCustomerModuls>();
_TVisMaskList = new List<TVisMask>();
_description = String.Empty;
}
#endregion // End of Default ( Empty ) Class Constuctor
#region Required Fields Only Constructor
/// <summary>
/// required (not null) fields only constructor
/// </summary>
public TModules(
int modulid)
: this()
{
_modulid = modulid;
_description = String.Empty;
}
#endregion // End Constructor
#region Public Properties
public virtual int Modulid
{
get
{
return _modulid;
}
set
{
_modulid = value;
}
}
public virtual IList<TCustomerModuls> TCustomerModulsList
{
get
{
return _TCustomerModulsList;
}
set
{
_TCustomerModulsList = value;
}
}
public virtual IList<TVisMask> TVisMaskList
{
get
{
return _TVisMaskList;
}
set
{
_TVisMaskList = value;
}
}
public virtual string Description
{
get
{
return _description;
}
set
{
if( value != null && value.Length > 30)
throw new ArgumentOutOfRangeException("Invalid value for Description", value, value.ToString());
_description = value;
}
}
#endregion
#region Public Functions
public virtual void AddTCustomerModuls(TCustomerModuls obj)
{
#region Check if null
if (obj == null)
throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
#endregion
_TCustomerModulsList.Add(obj);
}
public virtual void AddTVisMask(TVisMask obj)
{
#region Check if null
if (obj == null)
throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
#endregion
_TVisMaskList.Add(obj);
}
#endregion //Public Functions
#region Equals And HashCode Overrides
/// <summary>
/// local implementation of Equals based on unique value members
/// </summary>
public override bool Equals( object obj )
{
if( this == obj ) return true;
if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
TModules castObj = (TModules)obj;
return ( castObj != null ) &&
( this._modulid == castObj.Modulid );
}
/// <summary>
/// local implementation of GetHashCode based on unique value members
/// </summary>
public override int GetHashCode()
{
int hash = 57;
hash = 27 ^ hash ^ _modulid.GetHashCode();
return hash;
}
#endregion
#region IEquatable members
public bool Equals(TModules other)
{
if (other == this)
return true;
return ( other != null ) &&
( this._modulid == other.Modulid );
}
#endregion
}
}
When i start the application the following logfile is created:
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Init compiler for class Omis.Core.Domain.TModules
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\omis.web\e2d6b9a9\85e093ae\assembly\dl3\e0574ba5\123685ac_c1f1c601\NHibernate.DLL
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\omis.web\e2d6b9a9\85e093ae\assembly\dl3\8beb12ab\94ff0f84_b234c701\Omis.Core.DLL
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\omis.web\e2d6b9a9\85e093ae\assembly\dl3\e3613a64\ae4c6d5a_1efcc601\Omis.Data.DLL
13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Compiled with error:
using System;
using NHibernate.Property;
namespace NHibernate.Persister {
public class GetSetHelper_Omis_Core_Domain_TModules : IGetSetHelper {
ISetter[] setters;
IGetter[] getters;
public GetSetHelper_Omis_Core_Domain_TModules(ISetter[] setters, IGetter[] getters) {
this.setters = setters;
this.getters = getters;
}
public void SetPropertyValues(object obj, object[] values) {
Omis.Core.Domain.TModules t = (Omis.Core.Domain.TModules)obj;
try
{
t.Description = (System.String)values[0];
t.TCustomerModulsList = (System.Collections.Generic.IList`1[[Omis.Core.Domain.TCustomerModuls, Omis.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])values[1];
t.TVisMaskList = (System.Collections.
Generic.IList`1[[Omis.Core.Domain.TVisMask, Omis.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])values[2];
}
catch( InvalidCastException ice )
{
throw new MappingException(
"Invalid mapping information specified for type " + obj.GetType() + ", check your mapping file for property type mismatches",
ice);
}
}
public object[] GetPropertyValues(object obj) {
Omis.Core.Domain.TModules t = (Omis.Core.Domain.TModules)obj;
object[] ret = new object[3];
ret[0] = t.Description;
ret[1] = t.TCustomerModulsList;
ret[2] = t.TVisMaskList;
return ret;
}
}
}
13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Line:16, Column:60 Message:
Unerwartetes Zeichen `.
13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Line:17, Column:53 Message:Unerwartetes Zeichen `.
13:27:10.156 [3060] INFO NHibernate.Persister.GetSetHelperFactory - Disabling reflection optimizer for class Omis.Core.Domain.TModules
13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - CodeDOM compilation failed
I don't know where this unexpected Character comes from. It would be nice if anybody could help me to find a solution.
Thanks in advance