Silverlight 3 Released + RIA Services Installer Issue

As you probably know already, Silverlight 3 RTW has been released.  Download the tools for Visual Studio here:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=9442b0f2-7465-417a-88f3-5e7b5409e9dd

I made the mistake of uninstalling RIA Services before installing the Silverlight 3 RTW Tools thinking it would be a part of the installer (which it wasn’t).  Silverlight 3 RTW has a new project template called Silverlight Business Application that relies on RIA Services, and doesn’t appear in Visual Studio as a project template unless RIA Services is installed.  When I found it wasn’t installed I tried to install it again the installer told me it needed the Silverlight 3 Beta SDK to be installed in order to continue!  Brad Abrams from Microsoft let me know that there would be an update to the RIA Services installer soon, but in the meantime I came up with a hack to the installer to get it to install.  Download Orca, a .msi editor from here:

http://www.technipages.com/download-orca-msi-editor.html

After installing it, right click on the RiaServices.msi file and select Edit with Orca.  Select the InstallExecuteSequence table, and change the DependencyCheck action to Installed (instead of NOT Installed).  Then select the InstallUISequence table and make the same change to its DependencyCheck action.  Save the file, and try to install it again and it should install!  It’s a hack, and should be fixed soon, but in the meantime if you’ve uninstalled RIA Services like I did or you’re just getting started with Silverlight this should get you going.

Update: No sooner than I blog this then I’m told that the July Preview of RIA Services has been released.  So much for my impatience :).  Get it here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&displaylang=en#filelist

One more note, unfortunately the ComboBox control still doesn’t have the SelectedValuePath and SelectedValue properties for databinding in foreign key scenarios – a pet peeve of mine.  Tim Heuer from Microsoft said when I asked him that they have it down on their list but it didn’t make it this time unfortunately.

Advertisements

36 thoughts on “Silverlight 3 Released + RIA Services Installer Issue

  1. I have the code for the SelectedValuePath, can’t I send them the code? I would even be willing to manually produce a patch for them 🙂

  2. I avoided Silverlight3 until release date – so my VS2008 was 3-free. Had 2 on there.
    Installed the new tools installer, but it still says that the Beta sdk is missing when I try to install the RiaServices.msi downloaded from the July 09 site :-((.
    Do I still need this hack to get a clean install ??.

  3. Well – installed ORCA, made the recommended changes and its now installed.
    Thanks for the advice – lets start ‘playing’ 😉

  4. How could Microsoft release Silverlight 3 without fixing the Combobox SelectedValuePath and SelectedValue properties? Those 2 properties are the basic requirements for combobox in the first place! Without those properties, what’s the use of Combobox?

  5. Mohan: it’s disappointing they didn’t include those properties – especially with the focus in Silverlight 3 for business applications, but anyway… The ComboBox is still useful without those properties, just a little more difficult to use in foreign key scenarios.

    Graham: I’ve heard other people are having the same trouble – it’s a bit strange. I know when I tried to download the file it just downloaded the May release too. I changed browser and tried to download in IE and it downloaded the correct one. The file size of the July release should be 5,817kb, I suspect when you downloaded it you got the old version like I did. You’ll want to use the July version because they made major changes in this version and it took me a couple of hours to migrate my app to the new changes (admitted much of that trying to work out the changes and get my project to compile). RIA Services is really starting to come along nicely now – still a bit of work to go but it’s looking good (definitely improved over previous versions). Note that the .msi hack creates a few problems when trying to uninstall it (as I found last night). For some reason when uninstalling it complained about Silverlight 3 Beta not being installed (if you can believe it). My solution in the end was to search for RIA Services in the registry and delete those entries so it would think RIA Services wasn’t installed. Then delete the C:\Program Files\Microsoft SDKs\RIA Services folder on your machine. Yes, hacks result in problems like this :).

    Chris

  6. Hopefully that will be fixed. Do you have any open issue in connect? Could you send me the link to submit my vote?

    As soon as I update I’ll try some of the bugs that I found in the beta. The update problems with the Textbox are to me like the ComboBox issues for you. I hope this one got fixed.

  7. Hey Miguel – as I understand it there’s no Connect support for Silverlight. Apparently if you want to make suggestions or report a bug you need to do it on the silverlight.net forums. I didn’t log it there, but someone else did using the term I coined “The ComboBox Nightmare” in one of my articles on the SilverlightShow.net website, with a link to my article. Maybe send an email or twitter message to Tim Heuer? He seems to be pretty helpful and responsive when communicating with the community. I asked him at his LIDNUG presentation on Friday morning (Sydney time – 3:30am to 5am) and he said the team have it logged as an issue, and Brad Abrams is aware of it too (from his comment above). It’s ommission is disappointing primarily because of the fact it’s located in the core runtime making it hard for us to make a workaround to it, the big push in Silverlight 3 towards support for business applications (in which it becomes a really required feature), and because it would be such a small change (in the scheme of things) to make (about 15 lines of code really) which would save so much pain! Let me know if the RTW solves your TextBox bugs too as I know it’s caused you a whole lot of pain. Being in the core runtime it’s as hard to workaround as the ComboBox :). I must add however if anyone from the Silverlight team is reading this (since I know a couple already have), they really have done an awesome job with this new version – that can’t be denied. Pity about these few pain points though – since I’ve been making a noise about this one for about 8 months!

    Chris

  8. I’ll let you know how it goes. We’ll probably upgrade tomorrow or on tuesday all the dev and tester machines. In the beta we find many breaking changes, specially with the Datagrid.

  9. Yeah, there are a lot of breaking changes – depending on which features you use. A lot of my Silverlight 3 beta code needed updating. Part of it was changes to RIA Services (which I don’t think you’re using), a lot of changes to the DataForm, changes to the navigation framework, and changes to DLLs (a lot of things have changed which DLL they are in). Make sure you budget enough time to do the update – there are more changes than you might think! Anyway, that’s just what I found when I tried upgrading, your experience may differ :). You’ll need the document linked below – it will help you maintain your sanity. I didn’t have it for a good while and it would have saved me a lot of frustration:

    http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

    Chris

  10. We discarded using RIA Services since we need know it’s not going to be released until early next year. However with the Go-Live license we might be able to reconsider it, but we have a big investment on our current backend that migrating isn’t an option at the moment and I don’t like having two different ways of doing things.

    What do you think about RIA Services?

    There’re many bits that I didn’t like, specially I would like more control on the code generation process. We’ve been sharing objects and that works better than the code generation alternative.

    I remember there were a lot of namespace and assembly changes in the SL Toolkit of March, in theory they did it there to accommodate for SL3, but it looks like they were new changes 😦

    The main problem with moving controls to different assemblies is that in XAML we need to reference the assembly, which we don’t need to do in CodeBehind, thus making those changes way easier.

    Thanks for the reference.

  11. There’s definitely been big improvements made to RIA Services since I first looked at it, though I’ll have to reserve my opinion until I’ve given it a full run through. Previously my initial excitement didn’t hold up in reality, but I think some of these issues have been fixed. When I get a chance I’ll test it for the pain points. The problem is that the instance you can’t do something (which I found previously) then you need to go back to WCF, and you don’t want to be mixing and matching technologies – it’s one or the other. From what I can tell it still can’t handle Dictionary data types which becomes a pain point, and I’m still yet to be convinced that sharing code as I’ve detailed in my articles isn’t a more flexible solution. The code generation has definitely been improved, but the jury is still out as to whether it’s suitable for large scale projects yet. I’m still yet to decide!

    Chris

  12. I remember it was breaking Resharper and that was a big showstopper for me :p

    I agree on the Shared Code point.

    Other thing that was worrying me is to be able to split into different Class Libraries (e.g. you have some modules in the Middle Tier consumed by another project in the Client), I’m glad to see this is one of the improved scenarios.

  13. Yeah, well that ReSharper issue is a point to take up with JetBrains :). And like you say, now that you can create a RIA Services Class Library it’s a step in the right direction!

    Chris

  14. Well, probably R# will end up fixing it, however the problem is that the generated code is excluded from the project (which I think only RIA Services does), so R# can’t analyze it to do all it’s voodoo magic. This is probably something that MS should change.

  15. Yeah, I agree. From a screenshot I saw (I haven’t tried it for myself yet) when you create a client side RIA Services library it looks like an empty project with the generated code excluded. I can understand why they do it (because they’re not supposed to be edited), but it would probably be better to create an empty class (that you could add client side specific code to) in the project, with the corresponding generated class under it (like .designer.cs and other generated classes are). That would probably make more sense…

    Chris

  16. That’s the way other popular code generators work, like svcutil, L2S, EF, etc. Most of those tool have the problem that they generate a huge file containing all the classes. So they usually add one file to the project and then they just modify that one file

    Actually EF 4.0 takes a different approach and lets you use t4 templates and under your template you’ll all the generated files and all the files become part of the project.

  17. Hi Chris,

    I haven’t posted a comment in awhile. I appreciate your willingness to help Silverlight developers out. I have watched Tim’s video on .NET RIA services with Silverlight 3 and am excited to implement these strategies. Great stuff. I am trying to figure out how to use RIA services with stored procedures. Or probably more accurately, how to use stored procedures with ADO.Net Data Model.

    The debate of when to use stored procs and when not to is a big debate. I may begin to use them less, but if I would like to use them, do you have any recommended readings? But using the Domain Service linked to a Data Model, I should be able to project data from a stored proc execution like I would from grabbing the table, right?

    Appreciate your time,

    Sean

  18. Hi Sean

    Sorry for the late reply. To use stored procs or not is a big debate, though it does seem they are losing favour (except for where there’s a DBA nazi involved). I don’t have a strong position myself – the fact that they provide a contract for interactions with the database is nice, though if only a single application is using the database then a well designed data layer can perform this just as well. Arguments over speed are kind of moot in my opinion – assuming you are using paramaterised queries (which is a must if you’re not using stored procedures), then caching of query execution paths and such takes care of that (and in reality, the “compilation” hit of a query is small in respect to the actual execution time). With Linq to SQL, the Entity Framework, NHibernate, and so on, we seem to be moving away from stored procedures, and it certainly makes deploying updates into production simpler.

    RIA Services works really nicely with the Entity Framework (thanks to IQueryable), but as you say there’s nothing stopping you from using other data models or querying the database yourself (using stored procedures if necessary). It really comes down to an architectural decision on what you use as your data layer. I don’t think there’s much point these days in going right down to the level of SqlCommand and the data reader – the maintenance burden is rarely worth the slight speed increase you might get.

    My advice is probably to use stored procedures only if there is a real need, such as if you have a database used by many applications and you want a well defined contract for interactions with the database. But I’ll sit on the fence and say that I wouldn’t advise against using them either. I haven’t used stored procedures with the Entity Framework, but I don’t think you can use them for get operations – only insert/update/delete (I think). I don’t have any good sources of information on using them with the Entity Framework – but I’m sure a quick Google search would throw up some results. Hope this helps…

    Chris

  19. Thanks for the info Chris. Not that I would, but going down to the SqlCommand/Data Reader level, I would do this in the Domain Service and not need RIA, is that correct? Or do I still need (and should) to use RIA services since it offers much more? I guess I’m looking at what does RIA services give me? Automated CRUD operations?

    Thanks!

  20. Hi Sean

    Well a Domain Service is a part of RIA Services, so you would still be using it :). The big problem with RIA Services is that there’s no easy way of explaining what they are/do, resulting in a lot of misunderstanding. Essentially, RIA Services gives you a pattern and a bit of a framework to share data and logic across tiers. It doesn’t give you automated CRUD operations, though the wizard combined with the Entity Framework does make it easy to expose CRUD operations on your data. Nikhil Kothari has his own take here, which you might find useful:

    http://www.nikhilk.net/NET-RIA-Services-Twitter-Pitch.aspx

    In my book I’ll be going into a big spiel on RIA Services vs vanilla WCF, as despite the benefits of RIA Services there are a number of limitations and downsides that really need to be resolved. That said, it is only CTP at the moment, so will grow in time.

    The biggest benefit is how it works with collections exposed as IQueryable – enabling automatic filtering/sorting/grouping on that collection, saving a whole lot of plumbing. That’s really really nice, but it can be done manually too (I think I covered that in my second SilverlightShow.net article). It also saves having to add a service reference to your Silverlight application, having to set its correct url, and having multiple assemblies to share logic. But there are major downsides such as limited data type support (such as Dictionary), and every class needing to have a Key attribute. If these problems can be solved then I’m all for RIA Services, but if I need to use two methods just to implement all my data operations (RIA Services + WCF) then I won’t bother with RIA Services.

    My suggestion is to try RIA Services + Entity Framework, take advantage of their benefits, but if RIA Services starts getting in the way ditch it for the methods (providing much the same functionality) I have in my articles. Hope this helps…

    Chris

  21. Great info. Appreciate your help. Hopefully, I won’t wait so long next time, before dropping you a quick note.

    Thanks,

    Sean

  22. Ah yes, great post by Brad. I am 100% following, but I still have an overall questio of “Why do I need to bring in the DB tables into the model, if I’ll be using stored proces for CRUD operations.” It seems like I would need to bring in ALL DB tables, then map to the stored procs for the “read” operations.

    Thanks again!

  23. Chris,

    May I ask you a question along these lines? What is the Silverlight equivalent to the “SessionID” that was automatically created in the global.asa, etc. in ASP.Net. I need to rethink my logic in a number of areas since Silverlight 3 is “client technology”. But this came in handy to periodically stored in a DB or something along those lines.

    I will need to do something in the RIA side that projects onto Silverlight, but I am looking for an initialzied value that is unique, similar to a GUID. Such that when a new GUID is created I know this is a new “session”.

    Any thoughts?

    Thanks again!

  24. Hey Sean

    I’m personally against maintaining state on the server, so I’m probably not the best person to ask :). Of course there is the occasional need, but I avoid it like the plague where possible. What’s your scenario requiring this? (to see if there’s a better way).

    Two things off the top of my head (if you do need to do this). I haven’t tried, but I’d expect you still have a session ID (if session state is turned on) on the server which you could access in your WCF Service or domain service class (System.Web.HttpContext.Current.Session.SessionID). The other alternative is to simply create a GUID when your Silverlight application starts, cache it somewhere, and pass it through as a parameter on service calls to identify that instance of the application. Do either of those sound OK? But as I said, I usually find that session state causes more trouble than it’s worth, and that there’s usually a better way. If I know more about your scenario then maybe I can provide some better guidance. Hope this helps…

    Chris

    • Good advice. Appreciate it. My “old” days of using the unique session ID in the DB tier are still lingering 🙂 I’m trying to add an extra layer of security, but I may be off. My background is strong SQL (MCTS in SQL and Business Intelligence), so I like to add “belt and suspender” security measures when I can.

      Scenario: Create GUID when user is authenicated stored in the Isolated Storage and pass that to the DB and make sure the GUID is authenicated. A SQL script is running every 15 – 20 minutes to “remove” GUIDS from a database table, that have no activity. Therefore, if an Isolated Storage is hi-jacked, the DB will catch it.

      I like to store authenication/is logged in information in a DB table. I know, I know, hard habits are hard to break :). The ASP roles/authenication could be used and I’m still learning about that with Silverlight 3 and how to incorporate.

      I really like to store state in a DB table based upon a GUID, which maybe I need to change my thinking too. Once a user is authenicated a new GUID is created from a stored proc, passed to the Isolated Storage, and passed around, etc.

      Am I off base or is there a better way?

      Thanks,

      Sean

    • Forgot to ask: You mentioned “…create a GUID when your Silverlight application starts…” What event is fired when this occurs. Is it similar to the global.asax (On Session Start) or something like that?

      • Hi Sean

        Authentication is pretty easy to implement using RIA Services – if you try the Silverlight Business Application template it all comes set up for you using the ASP.NET membership providers. You might want to look into the forms authentication ticket (which ASP.NET forms authentication uses for both standard ASP.NET websites and Silverlight using RIA services) as the means of identifying the user. This is created on the server and contains details such as the username and expiry information (all encrypted using the machine key on the server). Even if someone did sniff that it would expire anyway within 30 minutes. This is stored in a cookie, but uses the HttpOnly attribute so it can’t be retrieved using javascript or any other means by your Silverlight application. If you add in SSL then it becomes even more secure. It’s not a perfect security scheme on its own (SSL makes it more secure, but no scheme is perfect), but I think it’s about on par with the scheme you’re describing.

        Where possible, I treat all web based applications as stateless (to the server). If you’re storing state in the database it’s probably better than simply storing data in the session state object to reside in memory (I have seen many abominations do that with problems aplenty). It’s a major change to thinking to make web applications stateless, and it depends on the situation as to if this is possible.

        I’d say you’re better off not storing the GUID or authentication ticket in isolated storage as it will still remain there after the application has closed (or crashed). Keep it in memory – that’s an advantage of having a rich client platform like Silverlight.

        If you still go ahead with using the GUID idea for security you’re probably better off generating the GUID on the server, generated when the user’s credentials are authenticated. But to answer your question on the event raised when the application is started, you’ll find if you open up App.xaml.cs there’s a Application_Startup event already defined.

        Hope this helps…

        Chris

  25. You mentioned storing the GUID (if I use this, which I may not), in memory: “…Keep it in memory – that’s the advantage of having a rich client….” Is that memory on the server (RIA) or the client (Silverlight)? Sorry for the silly question, I’m using to Session(“VariableName”) = xyz and I am trying to get a handle on this.

    I would think this is in the RIA side, that is projected onto Silverlight. Would I use the UserInformation.cs class that comes out of the box with RIA Business Applications?

    Thanks!

    • For that I was referring to the client (Silverlight). For example I was thinking you could have a class with a static property that could store it. But if you are returning it from the server, then as you say you could create a property on the UserInformation class (eg. SessionID) to return it to the client, and access it from anywhere in your Silverlight application via RiaContext.Current.User.SessionID (or whatever you call the property). Hope this helps…

      Chris

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s