When Equals is overridden, calling it causes proxy initialization.
But if you are loading the currencies in the same session, you don't need to
do that; NHibernate will create only one instance of each Curreny, so
default Equals or even == comparison will work.

    Diego


On Tue, Aug 24, 2010 at 11:03, vin <[email protected]> wrote:

> Hi,
>
> Here you go.
> Equality is tested by the Equals function below, that is what calls
> the Id property.
>
>
> On Aug 24, 3:50 pm, José F. Romaniello <[email protected]> wrote:
> > Please show your Currency class and mappings, and aslo show us how do you
> do
> > the equality in currency.
>
> --- Class ---
> public class Currency
> {
>    public virtual string Id { get; set; }
>    public virtual string Name { get; set; }
>
>    public override bool Equals(object obj)
>    {
>        Currency currencyObj = obj as Currency;
>
>        if ((currencyObj != null) && (Id == currencyObj.Id))
>            return true;
>
>        return false;
>    }
> }
>
> --- Mapping ---
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>                   assembly="XXX.Data"
>                   namespace="XXX.Data.Domain">
>
>  <class name="Currency">
>    <id name="Id">
>      <column name="CurrencyId" sql-type="nvarchar(3)" not-
> null="true" />
>      <generator class="assigned" />
>    </id>
>    <property name="Name" not-null="true" />
>  </class>
>
> </hibernate-mapping>
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to