Wow -- it is great to be done with Orcas Beta1... I can't wait to see what the feedback is like...

As it would happen, today I had an "Orcas success story"...  

Steve Marx is helping me with a demo for Mix and we just today moved it over from VS2005+ASP.NET AJAX+Silverlight to Orcas+Silverlight.   In doing so Steve "touched up" a few of the lines of code I wrote to take advantage of Orcas. Here is one such example.... I needed to enumerate all the items in a database, in each row I open an xml file that is referenced from the database and then pull some data out of that file and finally return that data in IEnumerable...

The code I wrote:

 

public class VideoDatabaseSiteMapData : DynamicDataSearchSiteMapProvider

{

    public override IEnumerable DataQuery()

    {

        SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

        objConn.Open();

        SqlCommand objCmd = new SqlCommand("SELECT * FROM [Items] ORDER BY [Title]", objConn);

        SqlDataReader reader = objCmd.ExecuteReader();

 

        List<VideoDataBaseEntry> list = new List<VideoDataBaseEntry>();

 

        while (reader.Read())

        {

            string mediaDefinitionPath = reader["mediaDefinitionPath"].ToString();

 

            foreach (string s in this.GetTimeStamps(mediaDefinitionPath))

            {

                VideoDataBaseEntry v = new VideoDataBaseEntry();

                v.ID = reader["ID"].ToString();

                v.Timestamp = s;

                list.Add(v);

            }

        }

 

        objConn.Close();

 

        return list.ToArray();

    }

 

    public IEnumerable<string> GetTimeStamps(string path)

    {

        List<string> l = new List<string>();

       

        foreach (string line in File.ReadAllLines(HttpContext.Current.Server.MapPath(path)))

        {

            if (line.Contains("<timeIndex>"))

            {

                int i = line.IndexOf("<timeIndex>") + "<timeIndex>".Length;

                int j = line.IndexOf("</timeIndex>");

                l.Add(line.Substring(i + 1, j-i-1));

            }

        }

        return l;

    }

}

 

which he changed to:

public class VideoDatabaseSiteMapData : DynamicDataSearchSiteMapProvider

{

    public override IEnumerable DataQuery()

    {

        return from video in new VideoDatabaseDataContext().Items.ToList()

               where video.MediaDefinitionPath != ""

               from node in XDocument.Load(HttpContext.Current.Server.MapPath(video.MediaDefinitionPath))

                .XPathSelectElements("/mediaDefinition/mediaItems/mediaItem/chapters/mediaChapter/timeIndex")

               select new VideoDataBaseEntry { ID = video.ID, Timestamp = node.Value };

    }

}

 

Pretty good huh?   I am glad I have Steve helping with this demo!   BTW, Come to my talk at Mix, or watch my blog here for more details on what the demo does... but it sounds cool doesn't it??

How about you?  got any Orcas Success Stories??