This project has moved. For the latest updates, please go here.

Delete statements in NQuery

Topics: Project Management Forum
Aug 15, 2007 at 3:16 PM
Are there any plans for supporting delete statements in NQuery?
Coordinator
Aug 26, 2007 at 3:15 PM
Edited Aug 26, 2007 at 3:20 PM
Hi AB_dreeve,

sorry for the late answer.

No, currently there are no such plans. The problem is basically that all DML statements such as INSERT, UPDATE, and DELETE are bulk oriented and SQL semantics require them to be performed atomically. For example, consider the following UPDATE statement:

	UPDATE Employees
	SET    Salary = Salary * 2
	WHERE  City = 'London'

No imagine that the property setter of the Employee class looks like this:

	public decimal Salary
	{
		get { return _salary; }
		set
		{
			if (_isIntern)
				throw new InvalidOperation("The salary of interns cannot be changed.");
			_salary = value;
		}
	}

If the update statement would affect 10 employees whereby 2 of them are interns the semantic states that the whole UPDATE statement should fail. That means that all changes already made to other employees must be rolled back. Implementing such semantics for arbitrary datatypes require some kind of transactional logic which is not easy to implement (if not impossible at all).

The same argument applies to INSERT and DELETE statements.