ApplicationContext.LocalContext["cn"] = cn;But Project.cs's DataPortal_Update() method does not.
It is intentional. As an author, I am stuck in this situation where I need to show multiple ways to solve the same problem in order to educate and inspire people to use the right solution for their particular scenario.
Project uses one approach when talking to the database, and Resource uses a different approach. Also notice that Project uses a Guid id, while Resource uses an Integer id - again, this is an arbitrary difference so I can illustrate two techniques to accomplish essentially the same goal.
The use of LocalContext in Resource is new for 2.1, but even in 2.0 Project and Resource worked differently.
It is important to note that Project is actually not ideal due to the unfortunate way System.Transactions works. Project and its children open many db connections, while ultimately forces the DTC to be used by System.Transactions (which is a flaw in Microsoft's implementation imo).
Resource is a better implementation in both 2.0 and 2.1, because it uses a single db connection and avoids the use of the DTC.
However, Project is a perfectly good implementation if you use Enterprise Services transactions...
It is all a series of tradeoffs...
RockfordLhotka:It is all a series of tradeoffs...
Copyright (c) Marimer LLC