Contact Me

Contact Us
For an informal discussion

Everyone's business is different. Our business is software - ask where we can help.
eMail: john at appsolo.com

Posts Tagged ‘RIA Services’

Dataforms and RIA Services

Tuesday, August 10th, 2010

image thumb1 Dataforms and RIA ServicesInitially, I didn’t take to the DataForm control but it’s growing on me. In our current app, we need to perform standard CRUD on users of the system. The client UI can be seen opposite.

The UI structure is that of a ListBox and DataForm. Both controls pull their data from a DomainDataSource which helps with sorting. The controls also keep in sync thanks to this common DataContext.

The DataForm has a lot to offer. Here’s a quick list of the jobs it handles in this example:

  • AutoEdit set to true means the DataForm lets me edit a selected Author right away.
  • DataField element of a DataForm lets me customise the appearance of the fields – in this case, the Photo field is rendered with a border and doubles as a Button to duplicate the functionality of the ‘Load Image’ Button.
  • CommandButtons (note top right corner) make add, remove and navigation commands available.
  • AutoCommit (set false here) saves changes without explicit ‘Save’ clicking.
  • Say I edit Bill’s password opposite; the ‘Save’ Button enables to support persisting (see caveat below). If however, I continue editing and change password back to ‘Bill’ as per the original value, then the DataForm notices that there really isn’t any change and again disables the ‘Save’ Button. Similar for ‘Reject’ Button. Note also, the custom words used by these Buttons.

The caveat mentioned above has to do with a change introduced to RIA Services in July CTP ‘09. I’m not the best guy to explain the thinking behind the change but the upshot is that changes made using the DataForm while handled properly, do not persist to the backing store. The ‘last mile’ needs to be handled manually with a call to SubmitChanges(). For example, to delete a record:

private void dataForm_DeletingItem(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            // Cancel DataForm's attempt at delete for all cases since DomainDataSource.Data doesn't accommodate changes
            if (MessageBox.Show("Are you sure you want to delete this author?", "Confirm Deletion", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                // Uses DataView to ensure DataForm's currentItem is deleted
                authorDomainDataSource.DataView.Remove(dataForm.CurrentItem);
                authorDomainDataSource.SubmitChanges();
            }
        }

This does muddy the water somewhat but the DataForm is still useful. It also integrates well with metadata added to the DomainService. In the above example, note the little ‘i’ icon next to some fields. These are brought across from the DomainService to the DomainContext which is the basis for the DomainDataSource and from there displayed on screen.

Also, custom validation class added on the web service side are respected by the DataForm. The ‘Save’ Button for example is disabled if there are validation errors. All in all, a reasonably competent way to provide basis CRUD operations on data sources.

Silverlight 4 Training Resources

Saturday, June 5th, 2010

image Silverlight 4 Training Resources Within Microsoft, it’s well acknowledged that Silverlight 3 –> 4 was a big move. Most of what was called for post-SL3 to make SL4 market-ready was delivered. Remember SL3 didn’t even do proper printing so there was a drive to make SL grow up – quickly. Thankfully, there are some good resources to help explore the space. I sometimes forget that Channel 9 do more than just interviews. A good case-in-point is this comprehensive training kit on SL4, complete with 25 hours of video across 8 targeted modules covering such key areas as RIA, MEF, authentication, and printing.

Wiring UP an Insert Stored Procedure to a RIA based application c#, VS2010

Thursday, May 20th, 2010

The stored Procedure I am using is one that creates a Taxonomical Key containing a root Node with an Arc emanating from the Root Node.

(more…)

Wiring UP an Insert Stored Procedure to a RIA based application c#, VS2010

Thursday, May 13th, 2010

The stored Procedure I am using is one that creates a Taxonomical Key containing a root Node with an Arc emanating from the Root Node.

(more…)

RIA Services Resources

Tuesday, May 11th, 2010

Update: RIA Services gone gold with version 1.0 (late May 2010)

1145.RIAServicesDiagram RIA Services ResourcesRIA Services is a step-change from WCF and for those migrating to internet-hosted data access frameworks. Since RIA only came of age following its release with Silverlight 4 and the significant enhancements to VS2010 that support it, it’s safe to say that it isn’t the most familiar animal to many.
Various show-tours seem to parade endlessly on the net showing carefully choreographed walk-throughs of tightly scripted RIA services handling – ‘Just drag the data source you like onto the canvas and lo, a datagrid miraculously binds itself to the necessary data’. And hey, here’s a Pager that cleverly knows to share the same data source. And look, no code – XAML rules. Well, yes but it all gets a bit ’samey’ after a time and once you start tackling a real-world task, you find that the showy stage show is just that – an act.
Now, to be fair, RIA Services is here to stay and that’s a good thing. However, taken with Entity Framework (bye, bye LINQ-to-SQL), a generous update to Silverlight and a crash-course in WCF, RIA Services carries a big stick and it takes some getting used to.
But RIA Services looks like the ‘next best thing’ for data access across the wire. And having had a quick look at WCF, that’s probably a good thing. Naturally, WCF is at the root of it all but RIA acknowledges that we don’t like heavy plumbing and provides a well-balanced abstraction. So having sat through way too many videos and walk-throughs that ever so neatly avoid real code, here is my collection of resources for learning RIA that pick up where that hand-holding leaves off.

  • Ronnie Saurenmann – Principal Architect MS has an excellent 45min video on RIA Services. Covering Entity Framework, DomainDataSource, Validation (including custom) and more. Not for the novice but good when you know enough to feel totally lost icon smile RIA Services Resources
  • Contoso Book Club – John Papa. Delivered at the SL4 launch keynote, this is a good worked example (source & starter project provided). The post walkthrough while mostly VS2010 tooling-driven, is well annotated and the example itself is rich enough to be credible. image thumb 39 RIA Services Resources
  • Building A Data-Driven Expense App with Silverlight 3 – Jonathan Carter and Terry Adams. Sorry, don’t know the authors but this MSDN piece (while pre-RIA RC – and man, MS like to change thing last minute) does an admirable job of walking through the code needed to wire up a DomainContext, looking at the role of Domain Operations in the generated DomainContext class, DomainDataSource objects to project data into new controls (like Data Form) – and they do it in code. Heck, I’ll appreciate the fancy VS2010 control handling later, but not until I understand what going on under the hood.
  • WCF RIA Services (MSDN) – Though this refers to pre-release RIA, it looks fine. Maybe I’m maturing but recalling how I recoiled every time I resorted to MSDN, I now find it more appealing. When it comes to a complex, multi-faceted and highly integrated framework like RIA, I really appreciate the carefully crafted (though often clinical) language of the technical writers at MSDN. This doc is very thorough and watch a good few videos before approaching it!
  • Silverlight 4 WCF RIA Services Line of Business Application Hands-On Lab – Sascha Corti & Ronnie Saurenmann. Over 100 pages of hands on explanation and guidance, starter & final solutions, published Dec ‘09 so targets SL4 – this is complete, thorough and well-written.

Deploying RIA services, SL4 & .NET 4.0 on shared hosting

Thursday, May 6th, 2010

I am deploying a WCF RIA application to a shared windows server 2008 instance operated by Blacknight and this is my side of the story so far.

Most shared Hosting environments do not offer great support for direct deployment from VS 2010 (or earlier). Yeah nothing is that simple! So I have to deploy using ftp (which must be setup also – Thanks John).

So when deploying RIA servicesbased application  you have two choices …..

1. Compile the assemblies locally (properties Copy Local to true .dlls in my day) to the bin folder and then when you deploy via FTP up to the server they go up there also. Which assemblies will be on the shared Host and which ones won’t is guess work I’m afraid as it will depend on a combination of what you deploy and what is already installed by the administrators of the hosted site. So I presume it depends on what your Hosting support has enabled in .NET 4.0 and the GAC?

2. Install RIA services on the GAC (not an option unless your kind tech support person will do it for you) and oh God it’s been a while since I looked at that GAC!!

Also you usually have to complete the roundness of IIS (IIS 7.0 in this case) and I’m no expert here but you’ll need to set up your Virtual directory to point at the directory that you upload to and then the fun starts. At this stage the Silverlight xap will most likely download to the Browser when the web application is loaded.

Saurabh Pant’s blog on RIA Services RC although now out of date (already icon sad Deploying RIA services, SL4 & .NET 4.0 on shared hosting )) is worth a read for hints on what then goes wrong.

I have gone with the first approach above and this is the error returned to the Silverlight client.

LoadError thumb Deploying RIA services, SL4 & .NET 4.0 on shared hosting

The ASP forms authentication works on a local deployment but is throwing an error on the GetUser() function also Even with the forms authentication turned off. So it might be over to my nice technician for the GAC update.

PS: OK. From reading around the subject matter

http://community.discountasp.net/showthread.php?p=39129

http://openlightgroup.net/Blog/tabid/58/EntryId/55/RIA-Services-Windows-Authentication-amp-GetUser-Error.aspx
and
http://forums.silverlight.net/forums/t/176108.aspx
and
http://blogs.msdn.com/saurabh/archive/2010/03/16/ria-services-application-deployment.aspx

it would appear that there are many possible pitfalls between IIS 7.0 (which we only have limited control over as it is Hosted) ASP.NET authorisation, RIA deployment (believe it or not the most control over) and Database management and Access (again Hosted and limited control/access due to Blacknight web based Database manager app). I could be wrong but the ASP.NET authorisation database is hidden from the developer. The sources say that you should use customised authorisation when working with hosted servers. When you create a Silverlight Business app in VS 2010, it automatically creates the infra-structure to support the ASP.NET authorisation.

So as we are going to handle user validation through our SQL Server 2005 database anyway, I’ll create a Silver Navigation template and introduce RIA services to that and then only have to deal with the second error above.

I’m reminded of the AI programming paradigm. Computing concepts work well in the Lab but the real world (wide web) is a complicated place!!.

If things do not improve, I think we will end up deploying on our own server.

PP.

Mike Taulty talks RIA Services

Tuesday, May 4th, 2010

Now that VS2010 and Silverlight 4 have finally gone RTM, so too has RIA services come of age. Though there are other means of bridging the client/server data divide, namely ADO.NET data services, RIA Services brings plenty of conveniences (such as validation on both sides and hiding the asynchronous data querying).

Mike Taulty is with the Developer and Platform Group at Microsoft in the UK. He has posted superbly in the past on LINQ-to-SQL and MVVM and this video provides an excellent introduction to RIA Services.

1 pages

latest news

UI Flow

Posted on Tuesday, 16th April, 2013

Often, we use wire-framing or mock-up tools (like the good guys at Balsamiq) to help communicate design ideas between developers as well as to clients. However, there is a need for something more efficient to aid communication of possible user interface flows through our emerging application. This communication is for internal use typically and doesn’t [...]

Testimonials

Excellent design skills

Posted on Sunday, 2nd May, 2010

We at Taxonomy.ie are happy to be associated with Appsolo and look forward to further work together.

follow me

twitter facebook delicious

AppsoloLtd. VAT No. IE97548691 - Copyright © 2010.