CodeSmith Community
Your Code. Your Way. Faster!

Concurrency management/TimeStamps - how to get working?

Latest post 10-17-2008 11:23 PM by SuperJeffe. 21 replies.
  • 09-10-2008 11:25 PM

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Concurrency management/TimeStamps - how to get working?

    I'm using NetTiers 2.2, and I'm trying to get some concurency management working in my windows forms app.

    So far I have:

    1) Added a timestamp field (called it "timestamp") to a table.
    2) Changed the "enableEntityTracking" option in the app.config file to true.

    Now when I generate the a concurrency error (two clients modifying the same record), I get an error, but it isnt a System.Data.DBConcurrencyException like I am expecting, but rather a generic SQL error.

    Do I have to do something more to get concurrency management working?

    Thanks.

    • Post Points: 5
  • 09-24-2008 4:21 PM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    Can anyone help me with this? Just a hint will do.

    Is concurrency code in any version of NetTiers? (I'm using 2.2).

    I have seen postings with code samples (for the nettiers scripts) necessary for concurrency, but these were old, and I'm not sure if things have changed since then.

    • Post Points: 35
  • 09-25-2008 3:48 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 444
    • Points 11,030

    Re: Concurrency management/TimeStamps - how to get working?

    I just haven't done any of this in my code.  I would have to do some testing in order to see what is going on and look to see how it was coded in nettiers.

    Sorry, just not sure how to answer your question.

    jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 09-26-2008 1:42 AM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    Thanks SuperJeffe,

    If I dont get a more positive responce, I might download the latest version of NetTiers (I'm currently using a 2.2 version which I have customised) to see if that has concurrency management in it.

    Failing that I might have to get my hands dirty (in the nettiers scripts) again.

    Shanon.

    • Post Points: 35
  • 09-26-2008 2:24 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 444
    • Points 11,030

    Re: Concurrency management/TimeStamps - how to get working?

    I would suspect nothing has changed with the Timestamp fields in the latest.  I don't recall anyone looking into it.  You could look at the change log but my guess is nothing has changed.

    I will still try to take a look at it if I get a chance.

    jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 09-26-2008 7:17 PM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    Rightio. Thanks.

    • Post Points: 5
  • 09-27-2008 6:50 AM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    I've done a bit more research. It seems that in the one table I have added a timestamp to, it is creating code to throw DBConcurrencyException (in the SqlProviderBase).

    The table in question is the Item table. When I make a concurrency error happen, the SqlItemProviderBase.generated.cs does indeed throw a DBConcurrencyException from the Update method.

    This throws it back to ItemServiceBase.Generated.cs (the exception handling of the Save method). This then runs the line:
                    if (DomainUtil.HandleException(exc, layerExceptionPolicy))
                        throw;
    The problem is, it never gets past the first line (DomainUtil.HandleException).

    In DomainUtil.cs, (HandleException method), it calls the line:
                    return ExceptionPolicy.HandleException(e, policyName);
    And from here an error gets thrown back to the presentation layer (where ItemService.Save was run from), only it is thrown as a normal error with an ugly SQL error, rather than a DBConcurrencyException error.

    This would imply to me that for some reason my application isnt configured to handle concurrency errors. Is this the case?

    Thanks,

    Shanon.

    • Post Points: 5
  • 10-05-2008 6:40 AM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    Well I'm fairly sure this is a configuration issue now - I have done some searching, and I beleive I have to modify the app.config to handle different types of errors. The problem is, I dont know how. For the life of me I have not been able to find a coherant example of what to do!

    If anyone can help me out here (configuring my project to handle different types of errors) I'd much appreciate it. I cant work this out and it is starting to become a major issue for me.

    Thanks.

    • Post Points: 5
  • 10-09-2008 7:24 AM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    I'm now thinking this is to do with my app.config file. It doesnt have an exceptionHandling section, where I think I might need one. But I having great troubles putting one in - I'm not 100% sure where it should go, and how it should be structured. Clear examples of what it should look like a hard to find.

    Can anyone help me?

    • Post Points: 35
  • 10-09-2008 11:58 AM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 444
    • Points 11,030

    Re: Concurrency management/TimeStamps - how to get working?

    This is the latest thread that places a bare bones rethrow exception handler in the app.config.

    http://community.codesmithtools.com/forums/p/4532/32892.aspx#32892

    There should be some documentation on the exception handling block on the msdn website.

    jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 10-09-2008 4:53 PM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    Thanks Jeffe,

    I've been researching this for quite some time now (15 odd hours I'm guessing) without making much progress. Beleive me - I dont just write a post at the first sign of an issue (although it may seem it sometimes). I'm convinced there is some little thing that I'm missing, which will make it all work when I change it - I just dont know what it is.

    For starters, I have doubts about my current app.config. I put it together some time ago, and besides this recent error handling issue, its been working fine. Just recently (during my research into this issue) I stumbled across the "Enterprise Library 4.0), which includes an Enterprise Library Configuration editor. I tried to use this to edit my app.config, but it couldnt see some of the settings (to do with the nettiers generated projects), and it couldnt save it (as it ws not valid or something). After I took the offending nodes out, the Enterprise Library Configuration editor could save it, but the application would not connect to a database. So - I dont know whats wrong here - if my current app.config file is invalid/corrupt, or if it is fine, and the Enterprise LIbrary Configuration editor has a problem.

    I should point out - I put together my original app.config file largely by guesswork, taking bits and pieces from various forums posting, until it worked.

    I tried putting in the text from the entlib.txt file you posted in that other posting, without any luck. I still get an error. The error is "The type initializer for 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy' threw an exception.".

    I realise that you (and others) answer queries on this forum for free, and hence can only spend so much time on each posting, and probably get annoyed when it seems like someone is asking to be spoon fed information. So, I'm willing to pay for assistance with this. That is, pay for someone to have a look at my current app.config file, let me know if there are any problems with it, and tell me what I have to do to get different types of errors thrown (like the Concurrency issue). If you (or anyone else) can do this, let me know.

    I realise that there is paid support advertised on the NetTiers site. I have used this in the past, but it went dead (stopped answering my emails) when I still had a week or two in my contract left, so I'm assuming thats dead.

    Thanks.

    • Post Points: 35
  • 10-09-2008 9:11 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 444
    • Points 11,030

    Re: Concurrency management/TimeStamps - how to get working?

    Yea, lol, I get the Nettiers emails now, well, I think blake and I do.  Robert still gets them but he is too busy at the moment to be able to help.

    Private message me your IM account and we will try and hook up.  We can try and work through it.  Although I will warn you I haven't used the concurrency stuff....maybe you could walk me through some.

    Another thought, the Unit Test project has an EntLib.config file, that should be able to load into the config tool.  Although, I haven't had much luck with it....you still have to really know what you are doing.  But the unit test project is a good place to look at the config.

    jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 5
  • 10-09-2008 10:49 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 444
    • Points 11,030

    Re: Concurrency management/TimeStamps - how to get working?

    I got this working.  What version of EntLib are you using?  I am using EntLib 4.  I don't think you will be using that.

    Attached are my 2 config files for my northind test project.  The only thing you will need to do is change the EntLib versions.  You can see everwhere that 4.0.0.0 is referenced in my files, and find your UnitTest project in Nettiers, and copy those lines out of that config file.

    If you let me know what version you are using, would take me only about 5 minutes to get one worked up for you.

    When I tested this, I got the ConcurrencyError in my test project.

    jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 60
  • 10-09-2008 10:55 PM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    Oh - Thanks.

    I'm using EntLib v2 (My version of nettiers doesnt go up to 4).

    • Post Points: 5
  • 10-14-2008 4:32 AM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 203
    • Points 5,048

    Re: Concurrency management/TimeStamps - how to get working?

    Nope. Didnt work. I took the app.config, copied it into mine, replaced the Version=4.0.0.0 with Version=2.0.0.0, Changed the Northwind project names to match mine, and it still wont throw a concurrency error. I keep on getting the "The type initializer for 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy' threw an exception." error.

    I should point out, when I edit it with the configuration editor (not just double clicking on it), it tells me there are errors with it.

    I didnt do anything with the entlib.config - I didnt know what to do with it - I dont seem to have one.

    I dont know what else to try now. I'm completely stumped.

    • Post Points: 35
Page 1 of 2 (22 items) 1 2 Next > | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems