Handle Race Conditions / Concurrency in Code First Entity Framework Applications

Preface A common scenario in developing applications is the handling of concurrent database updates. Given there is an application to manage customers, that is used by multiple users simultaneous. User U1 reads the data of customer C1. While user U1 is looking at this data, user U2 reads the data …

Disk Space Side Effects of SQL Server Data Tools

SQL Server Data Tools (SSDT) installs LocalDB, a new version of SQL Express. For details on LocalDB, please refer to Introducing LocalDB, an improved SQL Express. As Kevin Cunnane explains in the SQL Server forum thread Importing database always defaults to localdb, creating a SQL Server database project by SSDT …

Where Do SSDT SQL Scripts Connect To?

In some software projects I used empty Visual Studio solutions to create some kind of database projects. I added SQL script files to the solutions to create all database objects, like tables, functions, stored procedures, views, constraints, and so forth. A batch file was used to run all these scripts …

Create a SQL Azure Database using SSDT

To get into Microsoft Azure application development, I was playing around with SQL Server Data Tools (SSDT), trying to create a database on SQL Azure. I started creating a simple database, having two tables with a few columns. As done before with other tools, I was using the extended properties …

machine.config Overrides TransactionScope / TransactionOptions.Timeout

You are wondering why your DB-transaction, startet by using(TransactionScope scope = new TransactionScope(timeout)) runs into a timeout after 10 minutes? Because the <machineSettings maxTimeout=”00:10:00″/> in the system.transactions section of the machine.config has a default value of 10 minutes. And whatever is set as timeout of the TransactionScope by code – …

SQL Server Isolation Level Snapshot & DTC Promotion

SQL Server transaction isolation level Snapshot cannot be promoted by DTC. In case you open a transaction scope in .NET code, using isolation level snapshot, then open a connection, leave that connection open, and try to open another connection, you will retrieve an exception saying that a snapshot transaction cannot …

XML Data Row Truncation At 2,033 Chars When Using SqlDataReader

When you read Extensible Markup Language (XML) data from Microsoft SQL Server by using the SqlDataReader object, the XML in the first column of the first row is truncated at 2,033 characters. You expect all of the contents of the XML data to be contained in a single row and …