Rants Tagged with “Silverlight 2”

1  2  3  4  5  6  7  8  9  10  11  +  >  >>  (Total Pages: 13/Total Results: 121)

DevReach Panel Discussion Now on .NET Rocks

Silverlight Logo

While in Bulgaria, I was delighted to be on a panel about the future of Web Development including luminaries like Carl Franklin, Mark Dunn, Miguel Castro, Todd Anglin and Steve Smith. We discussed the Visual Studio tool set, MVC versus Web Forms, Silverlight versus everything else and some other interesting topics.  Luckily Carl recorded it all for a .NET Rocks show!

Listen in and let me know what you think!

Updated My Silverlight 2/Astoria MSDN Article

Silverlight Logo

I just found out that my changes to the article and code for Silverlight 2 RTW are now live. The article makes the small change that it no longer requires you to use EdmGem to build your proxy (using the Service Reference instead).  I've also updated the code example to be compatible with .NET 3.5 SP1 and Silverlight 2

In case you're not familiar with this MSDN Magazine article, it covers how to implement data access using ADO.NET Data Services and Silverlight 2 including reading and writing data.  Let me know if you have questions about it.

Coming to Florida!

Silverlight Logo

I am coming to West Palm Beach, FL on November 25th, 2008 to do my Introducing Silverlight 2. If you are in the area, don't forget to stop by to ask me about anything Silverlight (or anything else for that matter).

New Silverlight 2 ADO.NET Data Service Example

Silverlight Logo

I've finally had a chance to update my Silverlight 2-ADO.NET Data Services example. In this new sample I show how to create a Line-of-Business application (an XBox Game editor) using ADO.NET Data Services against both an Entity Framework model and NHibernate. Unlike earlier examples, this one includes implementation against the ADO.NET Data Service Silverlight 2 library to support saving of changed entities. In addition, I show some techniques for paging, retrieving simple types over an ADO.NET Data Service and full styling of the application. I hope to add support for Forms Authentication in the coming weeks.

Feel free to post replies with questions about the sample.

Controlling Service References in Silverlight 2

Silverlight Logo

I get this question a lot when I teach the Silverlight Tour and when I do talks at conferences and user groups:

Is there a right way to handle web service endpoints in Silverlight 2 when dealing with development and deployment servers?

The problem is that in Silverlight 2 you don't have a web.config file that can be modified as your application moves from development, to testing, to staging to deployment...or do you?

When you make a Service Reference in a Silverlight 2 project, a new project item called the ServiceReference.ClientConfig is added to your Silverlight 2 project. This file (as long winded the name is) contains the configuration for your endpoints and bindings to your web services. I think the idea around this configuration file was that much like ASP.NET: when you move a project across environments, you can simply edit the configuration file to make the change. This is fine but its not quite as trivial since the ServiceReference.ClientConfig file is embedded in the .xap file. Some people are opening the xap file and changing these bindings but I wanted to mention a different strategy...one that was only enabled in Silverlight 2 RTW (I think).

Let's take a small example of a ServiceReference.ClientConfig file for a project with a single service:

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicEndpoint"
                 maxBufferSize="2147483647"
                 maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:57929/MyTestService.svc"
                binding="basicHttpBinding"
                bindingConfiguration="BasicEndpoint"
                contract="MyServices.MyTestService"
                name="TestEndpoint" />
    </client>
  </system.serviceModel>
</configuration>

When you create a service reference, it creates this file and creates the configuration for the Endpoint as well as the Binding. In earlier versions of Silverlight 2, I would tell people to just use code to create their endpoints manually if they didn't want to edit this file during deployment. But we now have a different option. If you notice there is a name attribute on the endpoint. We can use this name in a new overload for the generated WebClient class for our service. For example:

MyTestServiceClient svc = new MyTestServiceClient("TestEndpoint");

svc.GetNamesCompleted += (snd, args) =>
  {
    if (args.Error != null)
    {
      throw args.Error;
    }
    HtmlPage.Window.Alert(args.Result);
  };

svc.GetNamesAsync("Shawn");

When we create our client proxy class (MyTestServiceClient in this case), we can specify the name of the Endpoint. This means we can pick the Endpoint at runtime instead of having to manually configure your Endpoint and Bindings in code.  For example, in the simple case we could change our ServiceReference.ClientConfig to support a new Endpoint:

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicEndpoint"
                 maxBufferSize="2147483647"
                 maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:57929/MyTestService.svc"
                binding="basicHttpBinding"
                bindingConfiguration="BasicEndpoint"
                contract="MyServices.MyTestService"
                name="TestEndpoint" />
      <endpoint address="http://WcsServer/MyTestService.svc"
                binding="basicHttpBinding"
                bindingConfiguration="BasicEndpoint"
                contract="MyServices.MyTestService"
                name="RealEndpoint" />
    </client>
  </system.serviceModel>
</configuration>

(NOTE: We could have created a separate binding as well as specified the binding in the bindingConfiguration attribute of the endpoint.)

Now that we have two endpoints, one for testing and one for deployment we can simply create code that knows the difference.  For example:

#if DEBUG
  MyTestServiceClient svc = new MyTestServiceClient("TestEndpoint");
#else
  MyTestServiceClient svc = new MyTestServiceClient("RealEndpoint");
#endif

In this example we simply use the compilation symbol (DEBUG) to determine which endpoint to use.

This technique is just another way of doing this. If your build environment is dynamic, opening the .xap file and editing the ServiceReference.ClientConfig may still be the best option, but this gives you choices

SilverlightData Examples - Coming Soon

Silverlight Logo

For the last few iterations of Silverlight 2 I've been keeping some data-driven examples on my sister site: www.silverlightdata.com. Since Silverlight 2 was released I've been working on a more comprehensive example using ADO.NET Data Services, NHibernate, Entity Framework and Forms-based Authentication. its taking longer than I'd like but when its live, I'll post about it here.  I've taken down the old samples since they haven't been refactored to work with the new bits.

Sorry for the confusion...

SQL Data Services is Cool...but It Won't Work in Silverlight 2

Silverlight Logo

If you are thinking about using SQL Data Services (the data part of the Azure stack) in your Silverlight 2 project, think again. As you might know, ADO.NET Data Services (Astoria) will not work cross-domain regardless of a security policy file (because of some limitations in the two networking stacks that Silverlight 2 uses). Its a problem but in most use-cases ADO.NET Data Services (Astoria) is used on the same domain so no biggie...but...

The Azure SQL Data Service uses Astoria to expose their data to the client...that means that with the ADO.NET Client Library that you can't access SQL Data Services. The reality is that since SQL Data Services requires basic authentication, it would not be terribly secure to call it in any case but this seals the deal.

The only good news is that since Astoria is just REST, you might be able to do the work to call it manually using WebClient or HttpWebRequest but its not an easy fix.

Too bad too, it would have been a great mix...SL2 + SDS.

Silverlight Testing Framework Sourcecode Released

Silverlight Logo

Announced yesterday on Jeff Wilcox's blog, the new drop of the Silverlight 2 Testing Framework is now available. The framework can be used to create unit tests for the Silverlight 2 application as well as do UI testing.

Go get it now and stop releasing Silverlight 2 apps you never bothered to test...you no longer have an excuse...

Silverlight 2 Toolkit

Silverlight Logo

Announced today and the PDC and now publically available is a new project from Microsoft called the Silverlight 2 Toolkit.  This toolkit contains new controls for Silverlight 2. The controls are available on CodePlex which means it is open source. The controls are being built by Shawn Burke's team inside Microsoft and have several "quality bands". These bands are "Experimental", "Preview", "Stable" and "Mature". This allows you to see what they're working on and determine which ones to use.  The available controls are:

Stable band:

  • DockPanel
  • HeaderedContentControl
  • HeaderedItemsControl
  • Label
  • TreeView
  • WrapPanel

Preview band:

  • AutoCompleteBox
  • ButtonSpinner
  • Charting
  • Expander
  • ImplicitStyleManager
  • NumericUpDown
  • Spinner
  • UpDownBase
  • Viewbox

No controls are Experimental or Mature yet.  The inclusion of the TreeView and WrapPanel are of most interest to me as building these controls manually are particularly difficult.

In addition to the controls, this package includes several built-in styles for skinning your application (using the ImplicitStyleManager).  These styles include:

Expression Dark Thumbnail Expression Dark Expression Light Thumbnail Expression Light
Rainier Orange Thumbnail Rainier Orange Rainier Purple Thumbnail Rainier Purple
Shiny Red Thumbnail Shiny Red Shiny Blue Thumbnail Shiny Blue

Go grab the package and start playing!  Don't forget to post bugs if you find them.

Netflix + Silverlight == Watch Instantly on Macs

Silverlight Logo

Interesting news from Netflix that they are going to be using Silverlight to stream movies to Macs to support their "watch instantly" service. They had left the Mac and Linux guys in the lurch for a while but its just fantastic that the Mac guys (and perhaps Linux with Moonlight?) will get the service. I suspect this is an extension of the XBox 360 deal. I wonder if this means that the streaming on the XBox is Silverlight 2 based? 

Is this cool or not?