Ejemplo n.º 1
0
        public Parent Copy()
        {
            Parent Copy = null;

            using (ISession Session = m_SessionFactory.OpenSession())
            {
                this.EvictProperties((Parent)base.m_ObjectFlow);
                Session.Evict(base.m_ObjectFlow);
                ((Parent)base.m_ObjectFlow).ID = HelperNHibernate.GenerateID();
                Copy = (Parent)Session.Merge(base.m_ObjectFlow);
            }
            return(Copy);
        }
Ejemplo n.º 2
0
 public void EvictProperties(Parent Entity)
 {
     using (ISession Session = m_SessionFactory.OpenSession())
     {
         Type           EntityType = Entity.GetType();
         PropertyInfo[] properties = EntityType.GetProperties();
         foreach (PropertyInfo Property in properties)
         {
             if (Property.PropertyType.Name.Equals("IList`1"))
             {
                 IList List = (IList)Property.GetValue(Entity, null);
                 foreach (Parent Item in List)
                 {
                     this.EvictProperties(Item);
                     Session.Evict(Item);
                     ((Parent)Item).ID = HelperNHibernate.GenerateID();
                 }
             }
         }
     }
 }