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
|
when same UnitOfWork calls same stored procedure that returns same id, StoredProcedure result is not expected by me.
This is code. ----------------------------------------------------------------------- StoredProcedure ----------------------------------------------------------------------- CREATE PROCEDURE spFoo @opt nvarchar(200) AS BEGIN SET NOCOUNT ON;
SELECT 1 AS Id, @opt AS opt END GO
----------------------------------------------------------------------- C# Code ----------------------------------------------------------------------- using System.Linq; using Mindscape.LightSpeed; namespace ConsoleApplication18 { class Program { static void Main(string[] args) { var context = new LightSpeedContext<FooUnitOfWork>("default"); // ------------------------- PATTERN 1 // ------------------------- PATTERN 2 I guess this behavior is due to LightSpeed Identity Map archtecture. Above code, PATTERN 2, Can I receive different results(same id) by each stored procedure call with one UnitOfWork instance? thanks, nabehiro. |
|
|
No. When LightSpeed sees an ID that is already in the identity map, it assumes this refers to the existing entity, and returns that rather than spinning up a new entity. You cannot have two entities of the same type with the same ID in the same unit of work. |
|
|
Hi, Ivan. Thanks for your very quick response! I consider Stored procedure return ID maked uniquely, or multi UnitOfWorks. |
|