Cw continues to impress.

Now this is just downright coolness:

using System;

public class Test
{
 static struct{string FirstName;string LastName;}* Employees()
 {
  yield return new {FirstName="David", LastName="Findley"};
  yield return new {FirstName="Lance", LastName="Hunt"};
  yield return new {FirstName="Chris", LastName="Kowalske"};
  yield return new {FirstName="Mike", LastName="Abdelmalek"};
  yield return new {FirstName="Eric", LastName="Wyllie"};
 }
 
 static void Main()
 {
  string* names = select string.Format("{1}, {0}", FirstName, LastName) as FullName from e in Employees() where LastName=="Findley";
  names.{Console.WriteLine(it)};

  Console.WriteLine();
   
  (select FirstName, LastName from e in Employees() order by e.FirstName).{
   Console.WriteLine(string.Format("{0}, {1}", it.LastName, it.FirstName));
  };

  Console.ReadLine();
 }
}

2 Comments

  • I like Cw, been working with it since they officially released it, and stayed up until 5 in the morning playing with it, lol!



    Coolest feature IMO is the direct XML. and to some degree the "select" statement. Another thing that is freakin SLICK is generating types from the database. Now we'll KNOW when a column datatype changes, instead of finding out through a diabolically camoflaged coersion that occasionally works...!



    I've been wanting to do the exact project: build a set of types that directly reflect the target database.



    One thing though, www.mattise.com Mattise is an object-oriented database engine it seems. Most of the "issues" of O/R mapping seem to fade away. I wonder if Microsoft should consider buying THAT technology and incorporating it into Cw/C#...

  • I played around with this a little as well. It's def. cool. One thing I would like to see it do though is turn stored procs into functions that return streams of structs:



    struct{int au_id;string name;}* sp_GetAuthors(...);



    I like the ide of treating stored procs as the database service contract. I think the creation of objects that model the table structure may be usefull if you are going to run your code in the database ala Yukon, but I'm not sure how great it is for client programs.

Comments have been disabled for this content.