C# Typed Query A type safe database query language library

Project Page
Quick Start

Get Typed Query at SourceForge.net. Fast, secure and Free Open Source software downloads

Code Example

Stored Procedure Example

Dynamic Example

Works with sql server and postgreSql.

Please note this project has moved to https://github.com/EndsOfTheEarth/Typed-Query


Typed Query (TQ) is a .net api that simplifies the task of querying databases. The api allows programmers to write sql queries in code that are type safe and access the resulting rows in a type safe manner.

TQ is designed to be simple to use and have a short learning curve. Queries use common sql syntax so there is no new query language to learn.

TQ outputs details about each query as it is executed. This is good for identifing queries that are slow, are being executed too often or are returning large amounts of data.

Features Include:

Select Example

So how do I get started?

Start by reading the Documentation.

Where is TQ at?

TQ is a fully fledged library but as of May 2013 TQ is not used in a production environment. In terms of features TQ is largely complete.

Note: There are production applications using the typed query concept very successfully (300-400 tables). It works extremely well.


TQ is released under the GNU Lesser General Public License (LGLP) version 3 license. This means the library can be used by both open and closed source applications.

Isn't this like Linq or an ORM?

No TQ is a library for performing type safe sql queries. Unlike ORM's the queries written in TQ match what is being sent to the database. This gives much lower level query control.

TQ is designed around sql so it has useful query features that Linq struggles with or doesn't support. For example left joins, unions, nested queries, temp tables, custom tsql, insert selects.

Also TQ is open source so coders can inspect, modify and add new features to the source code if needed.

How to start using Typed Query API

Left Join Example

Aggregate Function Example

Nested Query Example

Where Clause Example

Insert Example

Update Example

Delete Example

Code Generator

Screen shot of database definition generator.

Code Generator

 Copyright (C) 2009-2012 JFo.nz