Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Delete...Where #7

Open
4 tasks
worldspawn opened this issue Feb 10, 2016 · 1 comment
Open
4 tasks

Support Delete...Where #7

worldspawn opened this issue Feb 10, 2016 · 1 comment

Comments

@worldspawn
Copy link
Owner

  • Linq Expression Parser
  • T-Sql Language Processor
  • Postgres Language Processor
  • Query Api
@worldspawn
Copy link
Owner Author

Add support for deleting of entities that match a set of criteria. You do not to hydrate anything to use this.

In otherwords:

DELETE [Entity]
WHERE ...

as well as

DELETE [Entity]
FROM [TEntity]
JOIN ...
WHERE ...

I think this can run on top of the query system. The simple example might be:

session.Delete<Order>((o) => o.DateCreated < DateTime.UtcNow);

and more complex scenario: Delete orders that have order items and date created is less than now

session.Delete<Order>((ot) => ot.Join<OrderItem>((oi) => oi.OrderId == qt.Ex.Id).Where(o => o.DateCreated < DateTime.UtcNow))

ot is of type QueryTable<Order>

It'd be nice to add Join overload that includes both the source and target table entity refs which would look like:

session.Delete<Order>((ot) => ot.Join<OrderItem>((o, oi) => oi.OrderId == o.Id).Where(o => o.DateCreated < DateTime.UtcNow))

Of course you can join on anything and thats what the other overload is for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant