C# Future Directions (3.0) @ Petree Hall

Our leader speaks (Anders Hejlsberg). We'll look at the language extensions. LINQ Project recap: .NET Language Integrated Query (DLinq / ADO.NET) made possible by generics / anonymous types and delegates.

    C# 3.0 Design Goals
  • Integrate objects, relational and XML
  • Build on foundation laid in C# 1 & 2
  • Run on the .NET 2.0 CLR
  • Don't tie language to specific APIs (languages live longer than technologies)
  • Remain 100% backwards compatible

C# 3.0 Language Innovations: Query expressions (DLinq; System.Query) and XQuery-like expressions (XLinq; System.Xml.XLinq). You can extend this to do almost anything... bringing the power of strongly typed languages to queries. At one point, Anders showed how he could write a ToXml method that returned the query results as an XML tag. Total lines: 3. Wow!

Local variable type inference feature allows you to "infer" the type from the constructor. Anders says that this does not mean variant! :p

Query Expressions: Starts with from (zero or more from's or where's), optional orderby, ends with a select or group by, and optional into continuation. Queries basically translate to method invocations.

Expression Trees: Basically the CLR points to the database and reflects the structure into strong .NET types (Table<T>) and then remotes your expressions as trees back to the reflected structure via the methods (eg. where). So, basically we now have Code as Data brought by the these method generated expression trees. Finally, DLinq then takes the expression tree... and turns it into SQL.

DLinq code (the System.Query namespace) is available so we can see how they did it. Plenty of sample queries, code and documentation are available. There's even a LINQ Project Sample Query Explorer that tie it all the samples together with comparisons between XQuery and XLinq. Anders gave dev team $1 per query.

Summary: Anders and Microsoft have put a really compelling way to query databases directly from code. I'm impressed.

Tags: []

posted @ Wednesday, September 14, 2005 4:35 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345