protected DeleteCommandExpression UpdateDelete(DeleteCommandExpression delete, IdentifiableExpression table, Expression where) { if (table != delete.Identifiable || where != delete.Where) { return new DeleteCommandExpression(table, where); } return delete; }
protected virtual Expression VisitDelete(DeleteCommandExpression delete) { var table = (IdentifiableExpression)this.Visit(delete.Identifiable); var where = this.Visit(delete.Where); return this.UpdateDelete(delete, table, where); }
protected override Expression VisitDelete(DeleteCommandExpression delete) { if (delete.Identifiable.Entity.EntityType.Implements<IThing>()) { this.Write("DELETE Vertex "); } else if (delete.Identifiable.Entity.EntityType.Implements<IAssociation>()) { this.Write("DELETE Edge "); } else throw new NotSupportedException("Only Association and Thing types are supported."); bool saveHideIdentifiable = this.HideIdentifiableAliases; bool saveHideField = this.HideFieldAliases; this.HideIdentifiableAliases = true; this.HideFieldAliases = true; this.VisitSource(delete.Identifiable); if (delete.Where != null) { this.WriteLine(Indentation.Same); this.Write("WHERE "); this.VisitPredicate(delete.Where); } this.HideIdentifiableAliases = saveHideIdentifiable; this.HideFieldAliases = saveHideField; return delete; }
protected override Expression VisitDelete(DeleteCommandExpression delete) { this.Write("DELETE FROM "); bool saveHideIdentifiable = this.HideIdentifiableAliases; bool saveHideField = this.HideFieldAliases; this.HideIdentifiableAliases = true; this.HideFieldAliases = true; this.VisitSource(delete.Identifiable); if (delete.Where != null) { this.WriteLine(Indentation.Same); this.Write("WHERE "); this.VisitPredicate(delete.Where); } this.HideIdentifiableAliases = saveHideIdentifiable; this.HideFieldAliases = saveHideField; return delete; }
protected virtual bool CompareDelete(DeleteCommandExpression x, DeleteCommandExpression y) { return this.Compare(x.Identifiable, y.Identifiable) && this.Compare(x.Where, y.Where); }