Linq To SQL Tutorial
Check out some of my other Linq to SQL posts: EntityBase Inheritance Modifiers with SQLMetal Linq to SQL with WCF Services Linq to SQL Framework (Repository/Business wrapper) ObjectDataSource binding...
View ArticleLinq To SQL Tutorial – EntityBase – Base class for entities
When using Linq To SQL you may often find yourself in a position where you want each of your entities to inherit from a base class. As generated classes are partial classes you could create a second...
View ArticleLinq To SQL Tutorial – Set inheritance modifiers with SQLMetal
I have created an base class which my entities inherit from that gives a property called IsNew which returns true if the the value of ID is 0; all of my tables use ID for the identifier. For this to...
View ArticleLinq to SQL with WCF Services
I was interested to see how I could use Linq to SQL with WCF Services to load and save data using a Silverlight project. In this post I will expand upon the database I created in my Linq to SQL...
View ArticleLinq to SQL Tutorial – Base Repository/Business Logic wrapper
Before Linq to SQL I always separated out my Entities, Data Access Layer and Business Logic Layer. With Linq to SQL it’s a little different as I feel the generated classes are kind of like the Entity...
View ArticleLinq to SQL Tutorial – ObjectDataSource binding with paging and sorting
Update: 31/10/2009 – Added source code ASP.Net has the LinqDataSource which is a handy control but it embeds the business logic in the page which I don’t like. In this post am I going to use the...
View ArticleLinq to SQL – Using EntitySet.Remove to delete records
Download source Quite often you have two tables with a linker table which causes Linq to SQL to generate an EntitySet of the related records in each table. Take the following example: Here, the User...
View ArticleLinq Tutorial – Using the Enumerable.Any extension method
Consider the following: Using Linq I want to select all the roles for a particular user. I could create a query like this: This simply creates the following SQL: Alternatively I could use the Any...
View ArticleLinq to SQL Tutorial – Using Load Options to preload data immediately without...
Download source With Linq to SQL lazy loading is used by default. That means that if one object contains another object, the child object will only be loaded when first accessing it. Using Load Options...
View ArticleLinq to SQL Tutorial – Linq to SQL Generic Framework using reflection
Download source code In a previous post; Base Repository/Business Logic wrapper, I talked about a basic Linq to SQL Framework I created. I then extended it in my ObjectDataSource binding with paging...
View ArticleLinq to XML Tutorial
Download source This is an introduction to Linq to XML showing how to read, insert, update and delete from an XML file. First of all lets look at the XML file I will be using: As you can see it’s a...
View ArticleConvert a comma separated string of numbers to an integer array using C#
Today I needed to convert a comma separated string of numbers in an integer array. Here is how you can do it in one line using Linq:
View ArticleLinq lambda expression IEqualityComparer for IEnumerable.Distinct and Except
One of the things that annoys me with the IEnumerable.Distinct method is that it has no overload allowing you to give a lambda expression to specify a particular property to perform the distinction,...
View Article
More Pages to Explore .....