Beispiel #1
0
        protected void DeleteDataRow(Class dataClass, DataRow r)
        {
            var objId = Convert.ToInt64(r["id", DataRowVersion.Original]);
            var obj   = new ObjectContainer(dataClass, objId);

            ObjectContainerStorage.Delete(obj);
        }
Beispiel #2
0
        public int Delete(Query query)
        {
            var srcName   = new QTable(query.Table.Name);
            var schema    = GetSchema();
            var dataClass = schema.FindClassByID(query.Table.Name);

            if (dataClass != null)
            {
                var ids = ObjectContainerStorage.GetObjectIds(query);
                return(ObjectContainerStorage.Delete(ids));
            }

            // check for relation table
            var relation = schema.FindRelationshipByID(query.Table.Name);

            if (relation != null)
            {
                var rels = ObjectContainerStorage.LoadRelations(query.Table.Name, query.Condition).ToArray();
                ObjectContainerStorage.RemoveRelation(rels);
                return(rels.Length);
            }

            return(UnderlyingDalc.Delete(query));
        }