A tool that generates a strongly typed representation of a relational database, to be used for generating SQL queries in a type-safe fashion, with the aid of intellisense.
UPDATE (22/06/2008):
The source has slightly moved (to a sub folder):
http://svn.castleproject.org:8080/svn/castlecontrib/Tools/Castle.Tools.SQLQueryGenerator/
Usage sample (from Examples.cs in the test project:
SQLQuery q = SQLQuery
.Select(SQL.Blogs.Id, SQL.Blogs.Name)
.From(SQL.Blogs);
Console.WriteLine(q);
Would print out:
SELECT
[dbo].[Blogs].[Id],
[dbo].[Blogs].[Name]
FROM
[dbo].[Blogs]
Not impressed? Well,
dbo_ForumMessages Message = SQL.ForumMessages.As("Message");
dbo_ForumMessages Parent = SQL.ForumMessages.As("Parent");
SQLQuery q = SQLQuery
.Select(Message.Id, Message.ParentId, Message.Content)
.From(Message)
.Join(Parent, Message.ParentId == Parent.Id);
Console.WriteLine(q);
Will spit out
SELECT
[Message].[Id],
[Message].[ParentId],
[Message].[Content]
FROM
[dbo].[ForumMessages] AS [Message]
JOIN [dbo].[ForumMessages] AS [Parent] ON
([Message].[ParentId] = [Parent].[Id])
Need parameters?
Parameter<int> blogId = new Parameter<int>("BlogId");
SQLQuery q = SQLQuery
.Select(SQL.Blogs.Id, SQL.Blogs.Name)
.From(SQL.Blogs)
.Where(SQL.Blogs.Id == blogId);
Console.WriteLine(q);
would echo
SELECT
[dbo].[Blogs].[Id],
[dbo].[Blogs].[Name]
FROM
[dbo].[Blogs]
WHERE
([dbo].[Blogs].[Id] = @BlogId)