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
|
Basically I want to be able to Add a set of entities to the Unit of Work in one method and then in another method be able to see which entities were added. In EntityFramework I can use the Local collection which stores references to any entities added before calling SaveChanges. Does LightSpeed have an equivalent? Thanks, Bryan Migliorisi == More information == My use case is this: Two related entities are created at the same time. Both are also related to another entity, EntityUrl. EntityUrl.Url should be unique so my service method will check to see if the specified Url has already been added to the database and if so, will attempt to modify the Url to make it unique. Specifically it will continually attempt to add a number at the end of the Url until it finds a Url that does not exist: (Pseudocode) i = 1 while (url exists) { url = url + (i++) } The problem that may arrise here is that it is possible that two entities can be added to the same UoW before being committed to the database, in which case any query against the DB will not have these entities available. Suppose I add an entity with Url "hello-world" - it will check the DB an find that it is valid. No problem. Then the second entity is added with the same Url. The DB is checked and it is found to be valid. No problem. Until I SaveChanges() and find that i cannot add the second entity because of the unique constraints on the Url column. |
|
|
The UnitOfWork instance itself is enumerable and holds the collection of objects in the identity map, so you can query over this for new objects, e.g.
|
|
|
Excellent! Thank you, Jeremy . -Bryan Migliorisi |
|