Starting new SimpleMVVM Silverlight Application in VS2013

Mar 12, 2014 at 3:35 AM
In VS2013 the initial SimpleMVVM Silverlight project does not include the Silverlight enabled web site piece for the WCF Service. What kind of web site project must I add to the solution?
Thanks in advance
Mar 12, 2014 at 4:01 AM
I think you add an empty web-site project and then right-click on it. Select Add .. Add New Item.. and in the C# folder there is an option for a Silverlight Enabled WCF Service. his how I am proceeding for now .

Mar 13, 2014 at 4:00 PM
I think this needs to be fixed. The Silverlight (no RIA Services) option should add a Silverlight enabled Web Project for WCF services. I can't figure out how to add the correctly configured. I will ad it to the issues section. Thanks
Mar 13, 2014 at 4:10 PM
The VS 2012 version of Simple MVVM Toolkit installs some examples that I think will help you: There is a Main folder under samples that has a bunch of examples for using Silverlight with WCF.

I didn't include those with the VS 2013 version simply because both Silverlight and WCF are dead-end technologies. What you should do these days is use native client technologies with ASP.NET Web API. For the service-side, you might want to look at my Trackable Entities project. In the future I plan to come up with a template that combines Simple MVVM with Trackable Entities.

Mar 13, 2014 at 6:00 PM

Okay, Tony.

First I want to say I really appreciate SimpleMVVM. I’ve learned a great deal because of it and wouldn’t think of starting a new project without it.

I was having an issue because I bought a new computer and put VS2013 on it and not VS2012, I brought over an older VS 2012 Silverlight (SimpleMVVM) project that I need to complete (hundreds of hours already invested). I was getting errors updating the service reference, it wasn’t generating the proxy code in Reference.cs. I thought that maybe I had to start all over with a new project in VS2013. But I just found the answer to the problem, I think. There is service reference setting that needs to be changed. You have to UnCheck “Reuse types in referenced assemblies”. Now the proxy code is being generated. Hopefully there won’t be too many more glitches.

I’ve invested a lot of time in XAML, and like it too much, to abandon Silverlight (dead end or not). I may retire as a WPF/Silverlight only developer (I’m 62). I don’t look forward to learning Javascript/HTML/CSS etc. The vast majority (95%) of my 1200 or so clients still have the ability to use SL, so it’s still viable as far as I’m concerned. I realize there will become a time when I have to hire someone to rewrite these sites at great expense, but it’s at least a year or two out.

Thanks again

Burton Roberts

Extended Day Services

Pittsburgh, PA

(412) 608-4205

Mar 14, 2014 at 7:35 AM
Hi Burton,

Glad you found the answer to your question! I did want to follow up on adding a web host after first creating a standalone Silverlight project using the Simple Mvvm Silverlight template, It's just a couple of steps. First, add an empty ASP.NET Web project to the solution. Second, open project properties, select the Silverlight Applications tab, then click the Add button to add the existing Silverlight app. Lastly, set the web project as the startup project for the solution, and select the aspx test page as the startup page for the web project. That's it!

From there you can easily add WCF services to the web project. I prefer to create those services in one or more separate class library projects. The entities that you are using can also be placed in a separate class library project that is referenced from both the silverlight and web projects. In that case, your services references will work without having to uncheck that box indicating you wish to use referenced assemblies. As you found out, for that to function correctly, you need to remove the model classes from your Silverlight project and instead use the ones in your common entities project. I prefer that approach because you only have one set of entities to deal with and they are less likely to get out of sync.

By the way, is there some reason why you don't want to use Ria Services? I have a two-part video series on how to do that.

Mar 14, 2014 at 2:37 PM

Thanks again, Tony. I’m getting a lot for my $25.00!

I have used RIA services on other projects. And I initially learned MVVM through your online tutorial and programming reference which I carried around with me for months! This current SL5 project is based on an earlier Silverlight 3 project I built before I knew anything about RIA Services or MVVM. Also, I have a developed a comfort level with WCF Soap through my recent extensive work in WPF. I intend to catch up with the Web API stuff when I get a chance. But not until after my current project is deployed sometime in the fall. WCF Soap seems to do everything I need it to do, and so I’m not itchin’ to make a change. I have also gone through the Trackable Entities tutorial, but found it a bit overkill for my needs at present, and I wasn’t comfortable giving up the proxy classes and using ChannelFactory with WCF and EF6. I intend to take it up again, though, after I learn the Web API stuff.

Hope you are enjoying your new home in Eastern Europe. Or have you returned to the US?

Burton Roberts

Extended Day Services

Pittsburgh, PA

Mar 14, 2014 at 2:43 PM
Hi and thanks for the donation! Every bit helps. :-) I've used WCF extensively and also teach a class on it. Just realize that it's not considered "cutting edge" at this point.

We are setting in over here after seven months. We are coming back to the States for the summer and then returning here in the Fall. Amazing how the Internet has flattened the world.

Good luck with your endeavors!