Hello,

We've finally reached a point in our dev where we're performing CRUD 
operations, most of which works, apart from our own referenced key clean up 
(we're using a old-pre-designed database).

The problem we're having is that our objects that have composite keys don't 
appear to be updating - even when changed!

At current I am simply trying to update the Screen Number property and then 
calling flush. There are some other operations that happen (such as 
delete), but they are expected and irrelevant to this example.

Thanks!


My mappings are below:

    public class Xref_el_c : ClassMap<Xref_EntityCaseEntity>
    {
        public Xref_el_c()
        {
            Table("Xref_el_c");

            CompositeId()
            .KeyProperty(x => x.EntityRef, "xelc_el_ref")
            .KeyProperty(x => x.Case, "xelc_c_ref")
            .KeyProperty(x => x.ScreenNumber, "xelc_screen");
        }
    }


/*object*/
public class Xref_EntityCaseEntity : BaseCompositeEntity
    {
        public virtual int EntityRef { get; set; }

        public virtual int Case { get; set; }

        public virtual int? ScreenNumber { get; set; }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;

            Xref_EntityCaseEntity xe = obj as Xref_EntityCaseEntity;

            if (xe == null)
                return false;

            return EntityRef == xe.EntityRef && Case == xe.Case && 
ScreenNumber == xe.ScreenNumber;
        }

        public override int GetHashCode()
        {
            return (EntityRef + "|" + Case + "|" + 
ScreenNumber).GetHashCode();
        }
    }

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/dANrzSjHqQEJ.
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