Updates entities by executing SQL directly against the database. NB. No entities are materialized and therefore no callbacks run, cached entities are not updated in the second-level cache or full-text search index etc.

Namespace:  Mindscape.LightSpeed
Assembly:  Mindscape.LightSpeed (in Mindscape.LightSpeed.dll)
Version: 4.0.0.0 (4.0.0.0)

Syntax

C#
void Update(
	Query query,
	Object attributes
)
Visual Basic (Declaration)
Sub Update ( _
	query As Query, _
	attributes As Object _
)

Parameters

query
Type: Mindscape.LightSpeed.Querying..::.Query
A query used to determine the entities to update.
attributes
Type: System..::.Object
The attributes to be updated. This argument can either be an IDictionary<(Of <(TKey, TValue>)>), or, an object whose properties correspond to the target attributes (useful when using an anonymous type).

Examples

CopyC#
// Set the IsBadPaymentRisk flag on all customers who are more than 180 days behind on their payments
DateTime overdueDate = DateTime.UtcNow.AddDays(-180);
Query query = new Query(typeof(UserAccount),
  Entity.Attribute("Balance") < 0
    && Entity.Attribute("LastPaymentDate") < overdueDate);
unitOfWork.Update(query, new { IsBadPaymentRisk = true });
unitOfWork.SaveChanges();

See Also