Category Archives: SQL

IQueryable vs IEnumerable vs IHaveHeadache

Yes.. this ist just another blog post about IEnumerable and IQueryable. But the topic is quite important and I think it worth discussing about both approaches. Recently I had a discussion with a software architect about the implementation of the repository pattern. The question was: Should the repository return IEnumerable or IQueryable? So let’s do… Read More »

Entity Framework and Expression Queries

In my current project I had to generate a Entity Framework query based on some search criterias defined in a dictionary. The structure of the dictionary was similar to this example here: var searchCriteria = new Dictionary<string, List<string>>() { { "FirstName", new List<string> { "Darko", "NoName" } }, { "LastName", new List<string> { "Micic", "Müller",… Read More »

Entity Framework Code First And SQL Server DACPAC

Entity Framework Code First Migrations allows you to handle changes in your model (C#) by generating “migration scripts” for keeping the DB in sync with the code. It works very well. But I never used it in a project with more than 1 developer. I think we could run in different problems. And managing all… Read More »

SQL Server and “M”

I found an interesting link about the feature of SQL Server: Microsoft will release a new language called “M”. Link: Update on SQL Server Modeling CTP (Repository/Modeling Services, “Quadrant” and “M”)

SQL Server and XML Datatype

MSSQL supports since version 2005 XML Data. In this easy example you see how you can access the Data inside the XML Column. Here the Table Definition: CREATE TABLE [dbo].[person]( [id] [uniqueidentifier] NOT NULL, [firstname] [varchar](50) NOT NULL, [lastname] [varchar](50) NOT NULL, [data] [xml] NULL ) I added a new Row with following values: id… Read More »

Batch processing with Entity Framework .NET

Entity Framework is a built-in ORM in .NET. It’s great to work with. It handles the complete data access for you. (Connection, query generating, executing of SQL commands etc.) The performance is OK, if you don’t work with lot of data. The current release (.NET 4.0) doesn’t support batch processing. That means: If you add… Read More »

Creating CLR Stored Procedures

It’s possible to run .NET code inside a Stored Procedure. How it works: First create a new “Visual C# SQL CLR Database Project”. (There is a same template for VB.NET. But who uses VB nowadays??? :)) You have to define the connection to your database. If you are using Visual Studio 2010 be sure to… Read More »