CodeAttest
VSTS, Oslo, INETA, ASP.NET, Debugging .NET Applications, Tips and Tricks

September 15, 2005

LINQ and database definition

Microsoft presented the LINQ (Language Integrated Query) Project , a new syntax for querying databases and objects from C# 3.0. LINQ has been founded on generics, anonymous methods and nullable types that are going to be delivered in C# 2.0. The SQL integration is amazing. For example if you want to define a table created with the following DDL:

create table Orders (
OrderID nvarchar(32) primary key not null,
Customer nvarchar(32) not null,
Amount int
)


the CLR representation will be like next one:

[Table(Name="Orders")]
public class Order {
[Column(DbType="nvarchar(32) not null", Id=true)]
public string OrderID;

[Column(DbType="nvarchar(32) not null")]
public string Customer;

[Column]
public int? Amount;
}


I suppose that in the future the database model will be enough to create the database DDL script, data class definitions and data access layers using a code generator.

# posted by Martin Kulov @ 2:02 AM




This page is powered by Blogger. Isn't yours?

 




Calendar Martin Kulov's Calendar   RSS Aggregate this blog

DevReach - The Premier Conference for Microsoft Technologies for SEE

Mobility Day 2008 Conference

DevReach - The Premier Conference for Microsoft Technologies in Bulgaria

International Association of Software Architects

SofiaDev .NET User Group

Microsoft Most Valuable Professional

View Martin Kulov's profile on LinkedIn

MSDN Event Bloggers




Recent posts




History




 
Copyright © 2004-2008 CodeAttest Ltd. All Rights Reserved.