Adding Code in TFS Repository

Sep 5, 2012 at 7:41 PM
Edited Sep 5, 2012 at 7:54 PM


My company has started using the CSLA Extension and found it useful to use the "Include" functionality provided by the Entity Framework in the initial data retrieval when the object has one or more Navigation Properties. The advantage being that the database is only queried once, as opposed to for every Navigation Property record individually, as was found from my research using the SQL Server Profiler.

Regarding the performance considerations discussion on the Entity Framework (, it does mention that multiple "Include" statements can hinder performance; however, this is when data is being loaded unnecessarily (i.e. partial data sets that could be lazy loaded later or not at all). Because the CSLA objects created with this extension always force our objects to perform eager loading (i.e. load all Navigation Properties immediately), these objects are being populated initially anyway. For databases, one query allows for optimization and is better than numerous individual queries.

I would like to submit the code to CodePlex because others would then benefit from this code and it would also make upgrading to later versions of the extension less complex on my part as well. 

I am presently having difficulty logging into the TFS server using the information provided in the Source Code area:

Project Name: cslaT4
Subversion URL:
TFS Server URL:

If someone could help me in connecting to the TFS server so that I can submit the change myself, or simply add the code for me, that would be much appreciated.

The addition is a simple for loop to use the "Include" functionality in the initial DataPortal_Fetch.  The code below adds the loop to the latest version of the provided in the Dev folder.

private void <#= (entity.IsCollectionChild) ? "Child_Fetch" : "DataPortal_Fetch" #>()
   using (var ctx = Csla.Data.ObjectContextManager<<#= model.EntityContainerFullName #>>.GetManager(<#= model.ModelNamespace #>.<#= model.EntityContainerName #>Database.Name))             
      var data = ctx.ObjectContext.<#= entity.SetName #><#+
      foreach (NavigationProperty property in entity.NavigationProperties)
         if (property.HasGetter || property.HasSetter)
         #>.Include("<#=property.Name #>")<#+
      BeforeFetch(ref data);
      AfterFetch(ref data);

Oct 1, 2012 at 1:54 PM

Hi, thank you for your help. 

Please forgive me on my late response, I've been very busy these days. 

You can add code by yourself, I'll add you to the developer group. I've made some changes to a different branch, and I'm using that version for my development. When I get time I'll merge my branch with Main.

Please send me an email if you have any questions.