void NHibernate.UserTypes.IUserType.NullSafeSet( System.Data.Common.DbCommand cmd, object value, int index, NHibernate.Engine.ISessionImplementor session ) => cmd.Parameters[index].Value = value != null ? value: System.DBNull.Value;
public object Generate(NHibernate.Engine.ISessionImplementor session, object obj) { // can operate more handy with "obj", when all entities will be inherited from // common base class // todo: ?implement somewhere const for "Entities" string? return(PKGenDao.GetNextPK("Entities")); }
public void NullSafeSet(IDbCommand cmd, object value, int index, bool[] settable, NHibernate.Engine.ISessionImplementor session) { Vector3 vector = (Vector3)value; ((IDataParameter)cmd.Parameters[index]).Value = vector.X; ((IDataParameter)cmd.Parameters[index + 1]).Value = vector.Y; ((IDataParameter)cmd.Parameters[index + 2]).Value = vector.Z; }
object NHibernate.UserTypes.IUserType.NullSafeGet( System.Data.Common.DbDataReader rs, string[] names, NHibernate.Engine.ISessionImplementor session, object owner ) => names.Length != 1 ? throw new System.InvalidOperationException("Only expecting one column...") : rs[names[0]] is System.DateTime value ?
public object Generate(NHibernate.Engine.ISessionImplementor session, object obj) { object id = session.GetEntityPersister(entityName, obj).GetIdentifier(obj, session.EntityMode); if (id == null) { id = Guid.NewGuid().ToString(); } return(id); }
public object NullSafeGet(System.Data.IDataReader dr, string[] names, NHibernate.Engine.ISessionImplementor session, object owner) { Double x = (Double)NHibernateUtil.Double.NullSafeGet(dr, names[0], session, owner); Double y = (Double)NHibernateUtil.Double.NullSafeGet(dr, names[1], session, owner); Double z = (Double)NHibernateUtil.Double.NullSafeGet(dr, names[2], session, owner); if (x == null || y == null || z == null) { return(null); } return(new Point(x, y, z)); }
public object NullSafeGet(IDataReader dr, string[] names, NHibernate.Engine.ISessionImplementor session, object owner) { object obj0 = NHibernateUtil.Double.NullSafeGet(dr, names[0]); object obj1 = NHibernateUtil.String.NullSafeGet(dr, names[1]); if (obj0 == null || obj1 == null) { return(null); } double value = (double)obj0; string currency = (string)obj1; return(new MonetaryAmount(value, currency)); }
public void NullSafeSet(IDbCommand cmd, object obj, int index, NHibernate.Engine.ISessionImplementor session) { if (obj == null) { ((IDataParameter)cmd.Parameters[index]).Value = DBNull.Value; ((IDataParameter)cmd.Parameters[index + 1]).Value = DBNull.Value; } else { MonetaryAmount amount = (MonetaryAmount)obj; ((IDataParameter)cmd.Parameters[index]).Value = amount.Value; ((IDataParameter)cmd.Parameters[index + 1]).Value = amount.Currency; } }
public object NullSafeGet(IDataReader dr, string[] names, NHibernate.Engine.ISessionImplementor session, object owner) { var value = dr[names[0]]; if (value == DBNull.Value) { return(new ContentRelation()); } var id = (int)value; return(new ContentRelation { ForeignID = id, ValueAccessor = () => ((ISession)session).Get <ContentItem>(id) }); }
public object NullSafeGet(IDataReader rs, string[] names, NHibernate.Engine.ISessionImplementor session, object owner) { object vector = null; int x = rs.GetOrdinal(names[0]); int y = rs.GetOrdinal(names[1]); int z = rs.GetOrdinal(names[2]); if (!rs.IsDBNull(x) && !rs.IsDBNull(y) && !rs.IsDBNull(z)) { float X = (Single)Convert.ToDouble(rs[x].ToString()); float Y = (Single)Convert.ToDouble(rs[y].ToString()); float Z = (Single)Convert.ToDouble(rs[z].ToString()); vector = new Vector3(X, Y, Z); } return(vector); }
public object Replace(object original, object target, NHibernate.Engine.ISessionImplementor session, object owner) { return(original); }
public override NHibernate.Collection.IPersistentCollection Instantiate(NHibernate.Engine.ISessionImplementor session, NHibernate.Persister.Collection.ICollectionPersister persister) { return(new PersistentDetailCollectionList(session)); }
object ILazyInitializer.GetImplementation(NHibernate.Engine.ISessionImplementor s) { return(wrapped); }
object IUserCollectionType.ReplaceElements(object original, object target, NHibernate.Persister.Collection.ICollectionPersister cp, object owner, System.Collections.IDictionary copyCache, NHibernate.Engine.ISessionImplementor session) { IDictionary <string, T> result = (IDictionary <string, T>)target; result.Clear(); IEnumerable <KeyValuePair <string, T> > iter = (IDictionary <string, T>)original; foreach (KeyValuePair <string, T> me in iter) { string key = (string)cp.IndexType.Replace(me.Key, null, session, owner, copyCache); T value = (T)cp.ElementType.Replace(me.Value, null, session, owner, copyCache); result[key] = value; } var originalPc = original as IPersistentCollection; var resultPc = result as IPersistentCollection; if (originalPc != null && resultPc != null) { if (!originalPc.IsDirty) { resultPc.ClearDirty(); } } return(result); }
public void NullSafeSet(IDbCommand cmd, object value, int index, bool[] settable, NHibernate.Engine.ISessionImplementor session) { NHibernateUtil.Int32.NullSafeSet(cmd, (value == null) ? (object)null : ((ContentRelation)value).ForeignID, index); //if(value == null) // cmd.Parameters[index] = DBNull.Value; //else // cmd.Parameters[index] = ((ContentRelation)value).ForeignID; }
public PersistentDetailCollectionList(NHibernate.Engine.ISessionImplementor session) : base(session) { }
public void NullSafeSet(System.Data.IDbCommand cmd, object value, int index, bool[] settable, NHibernate.Engine.ISessionImplementor session) { Point point = (value == null) ? new Point() : (Point)value; if (settable[0]) { NHibernateUtil.Double.NullSafeSet(cmd, point.X, index++, session); } if (settable[1]) { NHibernateUtil.Double.NullSafeSet(cmd, point.Y, index++, session); } if (settable[2]) { NHibernateUtil.Double.NullSafeSet(cmd, point.Z, index++, session); } }
public object Generate(NHibernate.Engine.ISessionImplementor session, object obj) { return(null); //this should be custom implemented }
public object Assemble(object cached, NHibernate.Engine.ISessionImplementor session, object owner) { return(cached); }
public void NullSafeSet(IDbCommand cmd, object value, int index, bool[] settable, NHibernate.Engine.ISessionImplementor session) { var list = value as IList <TChoice>; NHibernateUtil.String.Set(cmd, string.Join(", ", list.Select(choice => choice.Id.ToString()).ToArray()), index); }
public override IResultSetsCommand GetResultSetsCommand(NHibernate.Engine.ISessionImplementor session) { return(new BasicResultSetsCommand(session)); }
public override NHibernate.Collection.IPersistentCollection Wrap(NHibernate.Engine.ISessionImplementor session, object collection) { return(new PersistentDetailCollectionList(session, (IList <DetailCollection>)collection)); }
public override object Copy(object original, object current, NHibernate.Engine.ISessionImplementor session, object owner, System.Collections.IDictionary copiedAlready) { return(original); }
NHibernate.Collection.IPersistentCollection IUserCollectionType.Wrap(NHibernate.Engine.ISessionImplementor session, object collection) { var dict = new Dictionary <string, T>(); return(new PersistentGenericMap <string, T>(session, (IDictionary <string, T>)collection)); }
public object Disassemble(object value, NHibernate.Engine.ISessionImplementor session) { return(value); }
public object Assemble(object cached, NHibernate.Engine.ISessionImplementor session, object owner) { throw new NotImplementedException(); }
public object Generate(NHibernate.Engine.ISessionImplementor session, object obj) { return(GuidCustomId.NewSequentialGuid(SequentialGuidType.SequentialAsString)); }
public object Disassemble(object value, NHibernate.Engine.ISessionImplementor session) { throw new NotImplementedException(); }
public object Replace(object original, object target, NHibernate.Engine.ISessionImplementor session, object owner) { throw new NotImplementedException(); }
NHibernate.Collection.IPersistentCollection IUserCollectionType.Instantiate(NHibernate.Engine.ISessionImplementor session, NHibernate.Persister.Collection.ICollectionPersister persister) { return(new PersistentGenericMap <string, T>(session)); }