My fantastic Webdings Logo

Reamped.NET

XML Thingey... It's a Technical Term


LINQ Distinct, a DataTable and the IEqualityComparer<T>

In a recent situation I was trying to pull some aggregates out of a DataTable using LINQ. I needed to get the rows of the DataTable with a Distinct clause, but my aggregates would be on other columns of the row. The problem is that when you call LINQ's Distinct() extension method with no arguments, it uses the "default IEqualityComparer". This means that it will work if you use the Select() extension method, only returning the column you want the distinct on. Well that works great, unless yo... [More]

Custom Entity Classes Using LINQ to SQL Part 3 - Queries

Multi-Part Series Custom Entity Classes Using LINQ to SQL Part 1 - DataObjects Custom Entity Classes Using LINQ to SQL Part 2 - Data Custom Entity Classes Using LINQ to SQL Part 3 - Queries So in the first part of this series we made some DataObjects and used attributing from the System.Data.Linq.Mapping namespace to make our DataObjects LINQ visible. Then in the second part of this series we made LINQ aware of our child DataObjects along with created the actual data store and a custom DataCon... [More]

Custom Entity Classes Using LINQ to SQL Part 2 - Data

Multi-Part Series Custom Entity Classes Using LINQ to SQL Part 1 - DataObjects Custom Entity Classes Using LINQ to SQL Part 2 - Data Custom Entity Classes Using LINQ to SQL Part 3 - Queries In my last post, Part 1 I showed the overview of how to set up your own entity classes or "DataObjects". This time, we are going to set up our inheritence mapping on the Animal class to inform LINQ that we have the child classes Penguin and Monkey. We already put the "Table" attribute on... [More]

Custom Entity Classes Using LINQ to SQL Part 1 - DataObjects

Multi-Part Series Custom Entity Classes Using LINQ to SQL Part 1 - DataObjects Custom Entity Classes Using LINQ to SQL Part 2 - Data Custom Entity Classes Using LINQ to SQL Part 3 - Queries Have you ever wanted to use the LINQ technology without being bound to the "LINQ to SQL Classes" item in Visual Studio? I know I have! I was wondering if there was a way to use LINQ, but doing it with my own DataObjects in either a ground up project or an add in scenario. It just so happens you ca... [More]