Skip to content

Tag Archives: linq2sql

LINQ to SQL Generic Repository

27-Jul-09

After my last post regarding the strange NotSupportedException I was receiving on my generic repository, I thought it might be fitting to post what my LINQ to SQL generic repository looks like and what it’s all about. WHAT’S A REPOSITORY? A repository defines methods which allow you to access data from your data model, typically [...]

Untie LINQ to SQL Connection String from Application Settings

26-Mar-09

Did you know that by default LINQ to SQL defines your connection string in more than one place if you define your LINQ to SQL classes out from a web app, such as a data access layer class library? Under “Application Settings” stored as Settings.settings and compiled in with your code rendering it unchangeable without [...]

LOG LINQ 2 SQL query execution to console/debug window

31-Dec-08

Wow, I just learnt a valuable trick in LINQ 2 SQL. Set your DB Data Context “Log” property to “Console.Out” and once a query has been executed by LINQ 2 SQL, the query executed is outputted to console! This is great, but I straight away would want this sending to a debug window or if [...]

Just another.. 'Linq to SQL vs. Entity Framework' Post on the Internet

14-Dec-08

I’ve been wanting to discuss Linq to SQL vs. Entity Framework for a while now and I had the opportunity to post on a stackoverflow.com question today (http://stackoverflow.com/questions/364740), so here is my quote with my thoughts on both frameworks… “Just be careful on the framework you do choose, to ensure it meets all your needs. [...]

How to use "IS NULL" with LINQ to SQL

11-Dec-08

Another “gotcha” using LINQ to SQL that I’ve found if you wish to test for “null” on a nullable column in SQL Server using the “IS NULL” clause. See below, this C# statement does not return the results you would expect (Assume “ReadMessageTypeFields()” simply returns an IQueryable result): return messageTypeFieldRepository.ReadMessageTypeFields().Where(x => x.MessageTypeID == messageTypeID).ToList(); Results [...]

My name is Graham O'Neale and I'm a software architect from Gold Coast, Australia. I am an overtime thinker, full time coder and awake part time in the real world. I have a keen interest in software development, particularly in the realm of programming (C#, ASP.NET, ASP.NET MVC, LINQ (2 SQL), Entity Framework, Silverlight, Blend, WCF, WPF) and a keen interest in the cutting edge and innovation. I have a new found love for design patterns, ALT.NET practices and well crafted software architecture. The purpose of this blog is to express any thoughts, findings, tips and gripes along my travels in the wonderful world of coding and technology...