Concurrency and the UnitOfWork2

Posts   
 
    
eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 05-Apr-2005 12:29:49   

Dears at the forum,

I am performing a non-recrusive save on an entity using the Adapter and the UnitOfWork2.


_uow.AddForSave(Entity, New ConcurrencyFilterFactory().CreatePredicate(ConcurrencyPredicateType.Save, Entity), False, False)

Using the SQL Profiler, I see that the SQL generated does take the predicate into consideration (a WHERE clause is inserted). Testing for optimistic locking (comparing the timestamp column of the table), I found out that the Commit of the UoW2 does not throw an ORMConcurrencyException, even if the number of rows affected is = 0. I downloaded the latest Installer, the date associated with the runtime libraries is 16. 3.2005. The same kind of dave using the normal adapter functioned pretty well!

Best regards

eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 05-Apr-2005 12:55:59   

Hi there again,

in the following thread http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2097 the same problem is described in great detail. I am assuming that the latest installer would contain the solution to this problem, but i keep on getting the same problem :-( Do I need to download a special fix?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Apr-2005 11:00:28   

Weird. With the runtime libs of 16 march, I test this:


[Test]
[ExpectedException(typeof(SD.LLBLGen.Pro.ORMSupportClasses.ORMConcurrencyException))]
public void UnitOfWorkRestrictionFailTest()
{
    using(DataAccessAdapter adapter = new DataAccessAdapter())
    {
        PredicateExpression filter = new PredicateExpression();
        filter.Add(PredicateFactory.CompareValue(CustomerFieldIndex.CompanyName, ComparisonOperator.Equal, "Soldes"));
        CustomerEntity chops = new CustomerEntity("CHOPS");
        Assert.IsTrue(adapter.FetchEntity(chops));

        UnitOfWork2 uow =new UnitOfWork2();

        chops.Country = "Holland";
        uow.AddForSave(chops, filter, false, false);
        uow.Commit(adapter, true);
    }
}

And it succeeds. (which is logical, CHOPS' company isn't 'Soldes')

Could you please check if the filter actually prohibits the save from updating a row?

Frans Bouma | Lead developer LLBLGen Pro
eugene
User
Posts: 85
Joined: 05-Oct-2004
# Posted on: 06-Apr-2005 12:58:26   

Dear Otis,

sorry for the inconvinience, the GAC contained the older versions and I had to update them using the latest version from the installation folder. The deinstallation of the last version required a restart and I missed checking the GAC for the right version.

Again sorry for this flushed

Greetings

PS (here in Hamburg the sun has been shining for the last 4 days, hope you have that too at the coast!)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Apr-2005 14:02:48   

eugene wrote:

Dear Otis,

sorry for the inconvinience, the GAC contained the older versions and I had to update them using the latest version from the installation folder. The deinstallation of the last version required a restart and I missed checking the GAC for the right version.

Again sorry for this flushed

Greetings

Hey no problem simple_smile

PS (here in Hamburg the sun has been shining for the last 4 days, hope you have that too at the coast!)

Here too! simple_smile Now it's cloudy and cold again...

Frans Bouma | Lead developer LLBLGen Pro