This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, is there way to hard delete records with soft delete column? I have an object A on which are depending other objects B (different table). If some objects B are depending on certain object A, I need to allow only soft delete for the object A (thus DeletedOn column is present), but if any B objects are depending on certain object A, I want to delete it from db completely. Is there different way than SP?
Thanks |
|
|
No. LightSpeed decides whether to soft delete or hard delete at the table level. There is no way within to choose soft or hard delete at the entity level: you will need to drop back to SQL. |
|
|
[quote user="ivan"] No. LightSpeed decides whether to soft delete or hard delete at the table level. There is no way within to choose soft or hard delete at the entity level: you will need to drop back to SQL. [/quote]
Ok, so close related question: how can I can get number of rows in db, deleted records included? UnitOfWork.Orders.Count(e => (e.CreatedOn.Year == DateTime.Now.Year) && (e.CreatedOn.Month == DateTime.Now.Month));
Thanks
|
|
|
Use the IncludeDeleted() operator: UnitOfWork.Orders.IncludeDeleted().Where(...) |
|
|
I don't have it. Is it some nightbuild news? I use may be a month old version.. (3.1.2376.15902 exactly). |
|
|
No, it's been there since 2.0, but you'll need to do: using Mindscape.LightSpeed.Linq; at the top of the file to bring the LightSpeed-specific LINQ extension methods into scope. |
|
|
Aaaha, still learning :) Again and again wondering how is Lightspeed delicious. Thanks, my problem solved. |
|