Nach Ordnungsbegriffen durchsuchen

Alle Ordnungsbegriffe » LINQ (RSS)

Easy Data-loading with LINQ-to-SQL and LINQ-to-XML von .Net Smoothie

.Net 3.5 had some nice tricks in it. LINQ-to-XML was one of them. With the new "X"-types, you can make working with XML really easy. VB.Net 9 takes it one step further, and lets you write XML in your code without strings. "Hey Rich, that’s...

Design Guidelines for LINQ von .Net Smoothie

Have you wondered if and when you should use the new LINQ features in .Net 3.5? Like, where should I put a new extension method? Should I use Func<T> or a custom delegate? How do I best implement a mix-in (extension methods on an interface)? Well...

LINQ or DIE von .Net Smoothie

I just read a fantastic quote about LINQ from the book Pro LINQ: Language Integrated Query in C# 2008 by Joseph C. Rattz, Jr.: I prefer to think of LINQ as a data iteration engine, but perhaps Microsoft didn’t want a technology named DIE. I think...
Abgelegt unter: , , , ,

The LinqDataSource and the Hidden Viewstate von .Net Smoothie

Yesterday I thought I’d learn about the LinqDataSource in ASP.Net 3.5, and got an interesting surprise. The new LinqDataSource can also be used with a LINQ-to-SQL model to perform updates. You simply add the DataSource to your page, set the table...

How to Update Data with LINQ-to-SQL von .Net Smoothie

When learning LINQ-to-SQL, it’s not immediately obvious how to do an update. Querying is easy, and there are methods for inserting and deleting. Updating usually occurs by modifying an object already known to the DataContext and then calling SubmitChanges...
Abgelegt unter: , , , , ,

How to See the SQL Generated by a LINQ to SQL Command von .Net Smoothie

Quick tip: If you want to see the SQL generated by LINQ to SQL for a query or command, simply set the Log property of your generated DataContext class to an instance of a TextReader. If this is your code: using System; using System.Linq; using System...
Abgelegt unter: , , , ,

How to Use Grouping in C# LINQ Syntax von .Net Smoothie

When you started using LINQ, did you think it looked like SQL? I did. The more I learned LINQ, the more I realized it wasn’t anything like SQL. Take grouping, for example. Because LINQ has a group by statement, and it looks like SQL, I assumed that...
Abgelegt unter: , , , ,

LINQ to DataSets - the Missing Manual von .Net Smoothie

Last week I had to prepare a small presentation for a new LINQ workshop. For my research, I browsed through the MSDN documentation on LINQ where I came across a reference to “LINQ to DataSets”. I couldn’t find any more information about...
Abgelegt unter: , , , , ,

Using LinqPad to Create a Time-Selector Drop-Down List von .Net Smoothie

I am really getting into LINQ now! I think it’s fantastic. I recently wanted to develop a quick drop-down list in ASP.Net which allows a user to select a time of day from a list. The times are 15 minutes apart, so the list would look like this:...
Abgelegt unter: , , , , ,

Using Lambda Expressions with LINQ to SQL von .Net Smoothie

When using LINQ, you need to be careful to use the right kind of Lambda expression. “What, there is more than one kind?”, I hear you gasp. There sure is! And if you aren’t careful, you’ll get a nice little message at runtime to...
Abgelegt unter: , , , ,

Inserting into a Table with LINQ to SQL von .Net Smoothie

While creating a little project, I wanted to know how to insert an object into a table using LINQ to SQL. Using Intellisense it wasn’t obvious at all. Scott Guthrie wrote a post on how do it. Unfortunately, the method name has changed since he did...
Abgelegt unter: , , , ,

Using LINQ To SQL’s DataContext in a Multi-Tier Application von .Net Smoothie

I’m still reading the excellent C# 3.0 in a Nutshell, by Ben and Joseph Albahari. It answers a popular question: how do I use a DataContext object in LINQ within a multi-tier application? According to the authors, you cannot use the DataContext...