Esempio n. 1
0
        /// <summary>
        /// Delete the aptify entity
        /// </summary>
        public void Delete( )
        {
            try
            {
                AptifyGenericEntityBase     aptifyEntity = this.server.GetEntity(this.table.Entity, this.store);
                AptifyNHibernateTransaction transaction  = this.store.Transaction;

                if (transaction == null)
                {
                    if (!aptifyEntity.Delete( ))
                    {
                        throw new DataException(aptifyEntity.LastError);
                    }
                }
                else
                {
                    if (!aptifyEntity.Delete(transaction.TransactionName))
                    {
                        throw new DataException(aptifyEntity.LastError);
                    }
                }

                Log.InfoFormat("Deleted {0}[{1}]", this.table.Name, aptifyEntity.RecordID);
            }
            catch (Exception e)
            {
                Log.ErrorFormat("Could not delete entity {0}: {1}", this.table.Name, e);
                throw;
            }
        }
Esempio n. 2
0
        public EntityStore(IEventSource session, Object entityObject)
        {
            if (session.TransactionInProgress)
            {
                this.transaction = ( AptifyNHibernateTransaction )session.Transaction;
            }

            this.entityObject = entityObject;
            this.session      = session;
            this.metadata     = session.SessionFactory.GetClassMetadata(entityObject.GetType( ));

            this.persister = this.session.GetEntityPersister(this.metadata.EntityName, entityObject);

            // Load the entity state
            this.status = GetEntityState( );
        }