Multiplicity my = (Multiplicity) y;
			if (mx==my) return true;
			if (mx==null || my==null) return false;
			return mx.count==my.count && mx.glarch==my.glarch;
		}
		public object NullSafeGet(IDataReader rs, String[] names, Engine.ISessionImplementor session, Object owner)
		{
Example #2
0
 public int GetHashCode(object x)
 {
     unchecked
     {
         Multiplicity o = (Multiplicity)x;
         return(o.count + o.glarch.GetHashCode());
     }
 }
Example #3
0
        public object GetPropertyValue(object component, int property)
        {
            Multiplicity o = (Multiplicity)component;

            return(property == 0 ?
                   (object)o.count :
                   (object)o.glarch);
        }
			Multiplicity o = (Multiplicity) component;
			return property==0 ? 
				(object)o.count : 
				(object)o.glarch;
		}
		public void SetPropertyValue(object component, int property, object value) 
		{
			Multiplicity o = (Multiplicity) component;
Example #5
0
        public object NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner)
        {
            int          c = (int)NHibernateUtil.Int32.NullSafeGet(rs, names[0], session, owner);
            GlarchProxy  g = (GlarchProxy)NHibernateUtil.Entity(typeof(Glarch)).NullSafeGet(rs, names[1], session, owner);
            Multiplicity m = new Multiplicity();

            m.count  = (c == 0 ? 0 : c);
            m.glarch = g;
            return(m);
        }
Example #6
0
        public object Disassemble(Object value, ISessionImplementor session)
        {
            if (value == null)
            {
                return(null);
            }

            Multiplicity m = (Multiplicity)value;

            return(new object[] { m.count, ForeignKeys.GetEntityIdentifierIfNotUnsaved(null, m.glarch, session) });
        }
Example #7
0
        public void SetPropertyValue(object component, int property, object value)
        {
            Multiplicity o = (Multiplicity)component;

            if (property == 0)
            {
                o.count = (int)value;
            }
            else
            {
                o.glarch = (Glarch)value;
            }
        }
Example #8
0
        public object DeepCopy(object value)
        {
            if (value == null)
            {
                return(null);
            }
            Multiplicity v = (Multiplicity)value;
            Multiplicity m = new Multiplicity();

            m.count  = v.count;
            m.glarch = v.glarch;
            return(m);
        }
Example #9
0
        public new bool Equals(object x, object y)
        {
            Multiplicity mx = (Multiplicity)x;
            Multiplicity my = (Multiplicity)y;

            if (mx == my)
            {
                return(true);
            }
            if (mx == null || my == null)
            {
                return(false);
            }
            return(mx.count == my.count && mx.glarch == my.glarch);
        }
Example #10
0
        public object Assemble(object cached, ISessionImplementor session, Object owner)
        {
            if (cached == null)
            {
                return(null);
            }

            object[]     o = (object[])cached;
            Multiplicity m = new Multiplicity();

            m.count  = (int)o[0];
            m.glarch = o[1] == null ?
                       null :
                       (GlarchProxy)session.InternalLoad(typeof(Glarch).FullName, o[1], false, false);
            return(m);
        }
Example #11
0
        public void NullSafeSet(IDbCommand st, Object value, int index, ISessionImplementor session)
        {
            Multiplicity o = (Multiplicity)value;
            GlarchProxy  g;
            int          c;

            if (o == null)
            {
                g = null;
                c = 0;
            }
            else
            {
                g = o.glarch;
                c = o.count;
            }
            NHibernateUtil.Int32.NullSafeSet(st, c, index, session);
            NHibernateUtil.Entity(typeof(Glarch)).NullSafeSet(st, g, index + 1, session);
        }
Example #12
0
        public void NullSafeSet(DbCommand st, Object value, int index, bool[] settable, ISessionImplementor session)
        {
            Multiplicity o = (Multiplicity)value;
            GlarchProxy  g;
            int          c;

            if (o == null)
            {
                g = null;
                c = 0;
            }
            else
            {
                g = o.glarch;
                c = o.count;
            }
            if (settable[0])
            {
                NHibernateUtil.Int32.NullSafeSet(st, c, index, session);
            }
            NHibernateUtil.Entity(typeof(Glarch)).NullSafeSet(st, g, index + 1, settable.Skip(1).ToArray(), session);
        }
Example #13
0
		public void Custom()
		{
			GlarchProxy g = new Glarch();
			Multiplicity m = new Multiplicity();
			m.count = 12;
			m.glarch = (Glarch) g;
			g.Multiple = m;

			ISession s = OpenSession();
			object gid = s.Save(g);
			s.Flush();
			s.Close();

			s = OpenSession();
			g = (Glarch) s.CreateQuery("from Glarch g where g.Multiple.glarch=g and g.Multiple.count=12").List()[0];
			Assert.IsNotNull(g.Multiple);
			Assert.AreEqual(12, g.Multiple.count);
			Assert.AreSame(g, g.Multiple.glarch);
			s.Flush();
			s.Close();

			s = OpenSession();
			g = (GlarchProxy) s.Load(typeof(Glarch), gid);
			Assert.IsNotNull(g.Multiple);
			Assert.AreEqual(12, g.Multiple.count);
			Assert.AreSame(g, g.Multiple.glarch);
			s.Delete(g);
			s.Flush();
			s.Close();
		}
		public object Assemble(object cached, ISessionImplementor session, Object owner)
		{
			if (cached == null)
			{
				return null;
			}

			object[] o = (object[]) cached;
			Multiplicity m = new Multiplicity();
			m.count = (int) o[0];
			m.glarch = o[1] == null ?
			           null :
			           (GlarchProxy) session.InternalLoad(typeof(Glarch).FullName, o[1], false, false);
			return m;
		}
		public object DeepCopy(object value)
		{
			if (value == null) return null;
			Multiplicity v = (Multiplicity) value;
			Multiplicity m = new Multiplicity();
			m.count = v.count;
			m.glarch = v.glarch;
			return m;
		}