Site Archives SQL

Simplifying Entity Framework: Data-Driven Design


This article reviews the theory and practice behind ADO.NET Entity Framework, discusses limitations of the current tools it provides and compares the benefits offered by solving the object-relational impedance mismatch against their costs. The article suggest using Entity Framework to improve and reduce costs of data-driven application design, which is prevalent in todays information systems and describes a code generation solution built using T4 Toolbox that can be used to achieve this goal.

T4 Toolbox: LINQ to SQL schema generator


This article describes how to use model-first approach to develop database applications using LINQ to SQL and version 9.5 of T4 Toolbox.

Crossing Domain Boundaries: Windows Authentication


This article describes a set of simple configuration changes and utilities to make most applications using integrated Windows authentication work correctly accross domain boundaries.

T4 Tutorial: Making code generators extensible


This post is a part of the series that introduces code generation with Text Templates (also known as T4 Templates) in Visual Studio using C# and Visual Basic; explains how to create reusable templates and combine them in complex code generators.

T4 Tutorial: Handling Errors in Code Generators


This post is a part of the series that introduces code generation with Text Templates (also known as T4 Templates) in Visual Studio using C# and Visual Basic; explains how to create reusable templates and combine them in complex code generators.

T4 Tutorial: Reusing code generators on multiple projects


This post is a part of the series that introduces code generation with Text Templates (also known as T4 Templates) in Visual Studio using C# and Visual Basic; explains how to create reusable templates and combine them in complex code generators.

Recent blog posts about T4


July blogs posts about code generation with T4 text templates.

T4 template for generating SQL view from C# enumeration


Database tables often contain columns that store codes, or values with special meaning. In application code, these special values can be encapsulated as enumerations. This article demonstrates how to use T4 code generation templates and Visual Studio CodeModel API to generate SQL views that encapsulate the special values for use in SQL code.

How to generate multiple outputs from single T4 template


For some code generation tasks, like generating SELECT stored procedures based on indexes of a given database table, number of output artifacts may not be known upfront. Because T4 was designed to generate a single output file from one template file, developers are forced to generate multiple code artifacts in the same source file. This conflicts with the widely used practice of using one source file per code artifact. This article demonstrates how to work around this limitation of T4, generate multiple files from a single template and automatically add them to a Visual Studio project.

How to use T4 to generate CRUD stored procedures


This article demonstrates how to use SMO and T4 templates to generate CRUD stored procedures in Visual Studio and integrate them in a database project.