Silverlight, Web Services, and Custom Classes Part I

by Lord Cod3n 28. October 2008 14:21

I know Silverlight.  I know data binding.  I know data binding in silver light to simple object, but custom objects tend to be a bit more interesting.   The problem started simple.  Lets use linq to sql to return a table called assets, and bind it to a grid in Silverlight.  Not so easy.  Why because you cannot to my knowledge use linq to sql with silverlight.  The silverlight runtime (which is a subset of the .net runtime) does not include linq to sql.  Ok  so lets  return a list of asset objects created and transformed into a custom class from a webservice.  That did not work.  Here is the first article I read on my Endeavour:

http://timheuer.com/blog/archive/2008/03/14/calling-web-services-with-silverlight-2.aspx

It looks like I could return xml.  This will work because silverlight supports Linq to XML.  Have I mentioned my foundness of Linq ;).    I should have known you cannot return a type of  XDocument.  I am going to return it as a string and convert it on the client. 

I started reading about linq to xml here:

http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx

Side Note 1:

Now this was a horrible idea.  It was recommended though.  I am running with a new testing framework called Test Driven.Net.  I need to detour to read about it.  Here is the link.

http://www.testdriven.net/quickstart.aspx

Back on topic soon. 

Here is the code so far to generate xml document from a linq to sql query

            var db = new AssetDataContext();
            var xml = new XElement("Assets",
                                   from rec in db.Assets
                                   select new XElement("Asset",
                                               new XElement("Barcode", rec.Barcode),
                                               new XElement("AssetNumber", rec.AssetNumber),
                                               new XElement("BarcodeChanged", rec.BarcodeChanged),
                                               new XElement("Comments", rec.Comments),
                                               new XElement("CurrentStatusCode", rec.CurrentStatusCode),
                                               new XElement("Description", rec.Description),
                                               new XElement("EquipmentNumber", rec.EquipmentNumber),
                                               new XElement("LastAudit", rec.LastAudit),
                                               new XElement("LastScan", rec.LastScan),
                                               new XElement("LastUser", rec.LastUser),
                                               new XElement("Location", rec.Location),
                                               new XElement("Manufacturer", rec.Manufacturer),
                                               new XElement("Model", rec.Model),
                                               new XElement("OldBarcode", rec.OldBarcode),
                                               new XElement("Picture", rec.Picture),
                                               new XElement("PlantName", rec.PlantName),
                                               new XElement("PlantNumber", rec.PlantNumber),
                                               new XElement("RecordFlag", rec.RecordFlag),
                                               new XElement("RequestedStatus", rec.RequestedStatus),
                                               new XElement("SerialNumber", rec.SerialNumber),
                                               new XElement("Sync_Start", rec.Sync_Start)));
            return xml.ToString();

I going to go ahead and post this up. I will follow it with more parts as I progress in the next couple of days. 

Side Note 2:

I am done with my presentation cd so those of you who asked for a copy of the cd it will ship out tomorrow.

Code Happy 

Bill Moore

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

It is coming

by Lord Cod3n 20. October 2008 04:59

My presentation went well on Thursday.  I took a short break afterwards to recharge the batteries and attend to some clients.  I will be posting up a video of the first hour of my talk, and the code samples.  If anyone of the attendees would like a copy of the presentation and the DVD I am making please send me an email.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Silverlight 2.0 final Release

by Lord Cod3n 14. October 2008 03:03

Wow I came across RC0 release last night.  I know I am a little behind.  Wearing all hats in a company tends to shift focus rapidly.  Here is Scott Gutherie’s well articulate blog about the release.

http://weblogs.asp.net/scottgu/archive/2008/10/14/silverlight-2-released.aspx

I am currently working on a presentation for the Beta 2 release.  I am going to go back and redo it for the final release.  Keep note there are breaking changes. 

Code Happy,

Bill

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Helpful Advice and New Direction

by Lord Cod3n 3. October 2008 09:37

We were lucky to get some advice from a great marketer.  His name was Gary Rosensteel.  He runs a website that helps offers start up advisory services for new companies at http://www.nucopro.com/ and an comprehensive entrepreneurial support web portal at http://helpstartups.com/

We were very appreciative to receive an hour of his time.  He helped us look at were we are and were we need to be.  We are going to correct course for the company and narrow our focus.  After speaking with Gary, we realized our current scope was still too broad.  He also mentioned finding a niche market and working towards excelling in it.  I am not sure what markets would the best to focus on right now with the way IT is changing.  I really want to help people develop good software and learn the new technologies, but the training market is over saturated in certain areas.  It was brought to our attention that when times are tight, this is the first part of the budget to get cut.  We have decided to move forward with three objectives: 

1.  Individual Developer Training Packages 

These will be focused on individual developers needs and will be priced so individual developers can purchase them. If their companies are willing, maybe they can be reimbursed.  I really hope to find a niche market here, and I don’t know of any other companies with these offerings.  This is going to have the least amount of focus, and we will be testing the space with our product offering.  We hope to have our first packet out within the next month.

2.  Kids Programming Course 

This is another one I think will be a lot of fun and maybe moved out a bit on the time line.  I am going to start look into setting up a package.

3.  Custom Software Development 

We have always been interested in custom software development and will continue to pursue this as the main source of income for Coden Enterprises.

 

I am still dedicated to pulling my TDD knowledge to the next level.  I have finished the book “Test Driven Development by Example” by Kent Beck. I will be continuing to focus on TDD as much as possible.  I am going to move Refactoring, Silverlight, JQuery, Powershell, and Sql Server 2008 way up the list for studying in attempt to adjust my focus.  

Code Happy,

Bill   

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

William Moore is the lead Software Architect and Technologist for Coden Enterprises. He has more than a decade of software development experience primarily Microsoft Platforms.  William enjoys the full gamit of coding everything from the UI down to the database.

Most comments

Page List