CSLA .NET

From Rockford Lhotka's Expert C# 2005 and VB 2005 Business Objects books

Welcome to CSLA .NET Sign in | Join | Help
in Search

Can't find the Business Objects in the PTracker Example

Last post 05-20-2008, 8:10 PM by RockfordLhotka. 2 replies.
Sort Posts: Previous Next
  •  05-20-2008, 10:17 AM 23698

    Can't find the Business Objects in the PTracker Example

    Can anyone tell me where the classes that define the business objects are located ?  I have looked in the PTracker.dal and PTracker.library projects but I can't find them.  They reason I am looking is to help understand how this framework establishes and manages the connection to the SQL Server Database.  I haven't been able to find the connection logic either.

    Thanks for any direction you can provide.

  •  05-20-2008, 3:25 PM 23705 in reply to 23698

    Re: Can't find the Business Objects in the PTracker Example

    They actually are in the library project.  It may be a bit confusing since the example is frequently using LINQ to SQL instead of the ADO.Net to make the calls.

    If you aren't familar with LINQ there is a pretty good set of introduction web casts on MSDN.  You can register and view one here.


    Building tomorrow's legacy applications today!
  •  05-20-2008, 8:10 PM 23712 in reply to 23698

    Re: Can't find the Business Objects in the PTracker Example

    When using LINQ to SQL the database connection is typically managed by the L2S data context object. That context class is defined in the DalLinq project, and was created by Visual Studio.

    In the Library project you'll see the DataPortal_XYZ methods. They are required by CSLA and are the points at which your business object must create/fetch/update its data using the DAL. Notice that this is the point at which the data context is used.

    Csla.Data.ContextManager is a CSLA .NET type that helps you manage the database connection contained within the data context. When using TransactionScope you must make sure to open and reuse one single database connection and ContextManager makes this relatively easy when using L2S.

    There's also Csla.Data.ConnectionManager that does the same thing for any raw database connection object (like a SqlConnection).


    Rocky
View as RSS news feed in XML

Please contact Magenic for your .NET consulting and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Powered by Community Server, by Telligent Systems