home recent topics recent posts search register faq   AspNetForum v.4.8.2.0

Huagati Systems Support Forum :: Forum

user:
psw:
| lost password
Home » Huagati Linq-to-SQL Profiler Support » Using Profiler with DBML tool Messages in this topic - RSS
8/4/2009 4:39:22 PM
smuskopf
Posts 3
I use the DBML EDMX tool to generate my DBML (.cs, .designer.cs, etc.) which includes the constructor for my DataContext. I now want to add the Linq-to-SQL profiler. So, I another constructor method in the .designer.cs to pass the enableProfiler flag. I then have to add to my DataContextProxy (.proxy.cs) constructor a call to this new method. Unfortunately, the proxy.cs gets regenerated and loses my changes.

How should I be implementing Profiler along with the DBML tool?
8/4/2009 9:24:41 PM
Kristofer
Posts 240
Hi,

Add the new constructor in a partial class in a separate .cs file in the same project (and same namespace as the datacontext), instead of in the generated .designer.cs file.

The generated datacontext and entity classes are all partial classes so you can add additional functionality in separate files as partial classes to avoid having the customizations overwritten whenever the generated code is re-generated.

E.g.:

C#:


VB:


Also see the profiler walkthrough in my blog at:
http://huagati.blogspot.com/2009/06/profiling-linq-to-sql-applications.html

.
edited by Kristofer on 8/4/2009

Attachments: dcProfilingSampleCS.png dcProfilingSampleVB.png
8/5/2009 10:16:29 AM
smuskopf
Posts 3
Duh - that worked. Thanks for the quick reply!
pages: 1
|

Home » Huagati Linq-to-SQL Profiler Support » Using Profiler with DBML tool