Welcome to my Blog

Here you will find my ramblings about pretty much anything I decide to talk about!
Email Image

Linq to SQL DataContext

Trev on Tue, 07 Oct 2008 22:07:56 GMT

I've been doing some work using Linq to SQL and I've come across a few things with the implementation that I disliked. I'm in the process of putting together an article detailing the problems I have with the DataContext class and how I managed to work around them. The article should be up in the next few days so keep an eye out for it!

I'm also going to put up a tutorial on creating an xml mapping source which will allow you to use POCO (plain old clr objects) with Linq to SQL as there are a couple of limitations to using the generated classes which in more advanced applications may cause you problems that you have to code around.

Examples of problems I encountered were:

- You don't get access to the getters and setters, you only get a partial method which is raised prior to the value changing or after the value has changed.

- You don't get access to the source code for the properties so if you want to add attributes to them you are stuffed since the code for the property is in a partial class in the generated class file which gets overwritten every time you add a new class to your DataContext.

- The DataContext does not implement any interfaces which means that all of your source code is tightly coupled to the DataContext, this makes it very difficult to do unit testing as you are always communicating with a database.


Comment1 Comments »

Separator Image

TableBuilder 1.0.0.3

Trev on Sat, 23 Aug 2008 13:08:00 GMT

TableBuilder 1.0.0.3 has been uploaded, also the application page for it has been updated and a page has been added to the reference section.

Comment0 Comments »

Separator Image

TableBuilder updates

Trev on Fri, 22 Aug 2008 15:39:05 GMT

Following a query from someone regarding the TableBuilder class, I'm in the process of updating the application page with a bit more info. I'm also adding a page to the reference section.

There is also a small update to the class which should be uploaded later today.


Comment0 Comments »

Separator Image

StyleCop 4.3 Released

Trev on Fri, 22 Aug 2008 15:35:25 GMT

StyleCop 4.3 was recently released, grab it at http://blogs.msdn.com/sourceanalysis/archive/2008/08/19/stylecop-4-3-is-released.aspx

I am currently in the process of analyzing all the code available for download on this site, so check back to see if there are any updates in the next few days.


Comment0 Comments »

Separator Image

Two new tutorials

Trev on Sun, 03 Aug 2008 19:36:08 GMT

Check out the 2 new tutorials!

Comment0 Comments »

Separator Image