Exemplo n.º 1
0
        public bool RetrieveObject(PersistentObject obj)
        {
            ClassMap             clsMap = GetClassMap(obj.GetClassName());
            IPersistenceProvider rdb    = clsMap.PersistenceProvider.GetCopy();
            bool blnResult = true;

            try
            {
                rdb.Open();
                blnResult = RetrieveObjectPrivate(obj, clsMap, rdb);
            }
            catch (Exception ex)
            {
                ErrorHandle(ex, obj);
            }
            finally
            {
                rdb.Close();
            }
            return(blnResult);
        }
Exemplo n.º 2
0
        public void DeleteObject(PersistentObject obj)
        {
            ClassMap             clsMap = GetClassMap(obj.GetClassName());
            IDbCommand           cmd    = clsMap.GetDeleteSqlFor(obj);
            IPersistenceProvider rdb    = clsMap.PersistenceProvider.GetCopy();

            try
            {
                rdb.Open();
                if (rdb.DoCommand(clsMap.GetDeleteSqlFor(obj)) > 0)
                {
                    obj.IsPersistent = false;
                }
            }
            catch (Exception ex)
            {
                this.ErrorHandle(ex, obj);
            }
            finally
            {
                rdb.Close();
            }
        }