The Elephant and the Silverlight

Thoughts and analysis of Silverlight for business applications

Page List

    Undocumented DomainService Wizard change in WCF RIA Services

    UPDATE: Turns out this is a bug, check this newer post.

    As everybody is busy upgrading their .NET RIA Services application to a WCF RIA Services application, there is one change that wasn't documented as it isn't a breaking change but it is something you probably want to look at. The DomainService wizard generated Update methods slightly differently then it used to.

    The previous version would have generated something like this:

    public void UpdateMyEntity(MyEntity currentMyEntity)
    {
        this.ObjectContext.AttachAsModified(currentMyEntity, this.ChangeSet.GetOriginal(currentMyEntity));
    }

    The new version will look like this:

    public void UpdateMyEntity(MyEntity currentMyEntity)
    {
        if ((currentMyEntity.EntityState == EntityState.Detached))
        {
            this.ObjectContext.AttachAsModified(currentMyEntity, this.ChangeSet.GetOriginal(currentMyEntity));
        }
    } 

    If you don't want to regenerate all of your DomainServices I recommend going through and making this change yourself. It is a pretty easy change and makes sure that your code matches everybody elses.

    UPDATE: The Breaking Changes document is being updated to have this information.


    Permalink | Comments (1) | Post RSSRSS comment feed

    A guide to new features of WCF RIA Services

    This is an exciting day, everyone can now get their hands on the brand new WCF RIA Services.  Here is a quick guide to some of the new features in WCF RIA Services as well as my personal guidance on how you can use the new features.

    The new name

    OK, WCF RIA Services has now replaced .NET RIA Services. I know I have talked about the ADO.NET Data Services integration but it turns out that RIA Services has gone beyond that (it has gone plaid!) and it now fully a WCF service. By default, your DomainService is now exposed as a standard WCF service using binary encoding. Sweeeeet!

    Stay tuned to Saurabh Pant's blog for more information on how WCF is used by WCF RIA Services.

    New rules for Error Handling

    This is probably the most important change to understand while converting to the new WCF RIA Services. If errors come back from a SubmitOperation, InvokeOperation, or LoadOperation and is not handled by us then an exception will be thrown. This stops the problem where people new to RIA Services try to Submit or Load and never get an error, they will now get an exception. This can be a breaking change if you have errors coming back from the server that you were not previously handling.

    Compositional Hierarchy

    This is a big change for people who need real parent/child hierarchies in their code. For example, with a compositional hierarchy the parent’s HasChanges will be true if the child has been changed. However, I think a question that needs to be answered is what the default setup should be. My guidance here is that if you need composition, use composition. If you don’t need composition, or if you don’t know if you need composition, then don’t use composition. The default no-composition model is more flexible and has the potential of having better performance.

    Inheritance Support (VS2010 Only)

    This has been one of my biggest feature requests. I am extremely happy to say that not only does WCF RIA Services support inheritance, but the team has gone way above and beyond the level of support that I would have been happy with. They really did an incredible job and it is a real testament that Microsoft is listening to us.

    Presentation Model

    This is huge addition to WCF RIA Services and I don’t think the potential for this feature is really fully understood yet. I think there is going to be a tendency by some people to think that “Best Practices” would be to always use PM for all entities. I don’t think this is the case, it is easy to replace a regular entity with a PM entity without having to change the client so I think the better model is to mix PMs in with regular entities as you need them.

    Domain Data Source Changes

    I am not an expert in the use of the DDS. Personally, I don’t use it but I know that a lot of people do. The new version of the DDS has the bugs worked out and some simplifications made. Stay tuned to Jeff Handley’s blogfor all of the details.


    Permalink | Comments (0) | Post RSSRSS comment feed

    Updated ApplyState/ExtractState Library

    Export more blog entries this week. I will be putting up my guide to the major new features after todays keynote.

    In the meantime, here is an updated ApplyState/ExtractState refactored to use the EntitySet instead of the EntityList. I will put up a VS2010 version as well tonight.

    RIAServicesContrib2008.zip (235.60 kb)


    Permalink | Comments (5) | Post RSSRSS comment feed