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
|
I wanted something like:
And I've added the following code:
But it doesn't work. I have the following error instead:
Any advice would be appreciated. |
|
|
The overload you are using is actually expecting a variable number of objects rather than an array instance. So you would want to specify it as :
Alternatively you can specify this in a LINQ query using an array by using the Contains method on the array - e.g.
|
|
|
Yes, that's what I'm thinking, however, does this work for uow.Remove() as well? |
|
|
We actually have an extension method you can use in conjunction with LINQ rather than calling to uow.Remove(). To use this make sure you have a using statement included for Mindscape.LightSpeed.Linq and then you can use the .Remove() extension method at the end of your query expression to cause a remove based on that query. e.g.
|
|
|
Great. This is something new to me. Thanks. |
|
|
I have I'm actually interested in updating some records based on a LINQ query.
Is there some method that does this? |
|
|
Make sure you are using a nightly build as .Remove() was added post 4.0. We dont provide a facility for bulk updates via LINQ (nor are we intending to) so there is no equivalent extension method. You can achieve bulk updates against the database via UnitOfWork.Update(), a stored proc or executing a raw ADO.NET command by using UnitOfWork.PrepareCommand(). If you want to do this by sourcing the entities with a LINQ query then your best bet would be to do something like:
|
|
|
Thanks, I'm using this now:
Because I explicitly have an object[], the compiler will not hit on the params keyword, but instead pass the values as intended. BTW how does the syntax highlighter work, it is not clear at all from the editor... |
|
|
We use Prettify: http://code.google.com/p/google-code-prettify/ so that just automatically applies the syntax highlighting :)
|
|
|
hi.,
|
|