RIAServices

There are 16 entries for the tag RIAServices
Lookups in DataGrid and DataForm with RIA Services

While off reading random blog posts on the tubes, I stumbled upon a post that describes a 101-level scenario of using lookup data in the DataGrid and DataForm with RIA Services.  The author was struggling to find a solution for the problem and was clearly frustrated. The scenario is very common; let’s use the Cars example where every Model refers to its Make. We want a DataGrid that includes the make name as a column: And we want a DataForm with a ComboBox for the Make:   ...

posted @ Friday, March 12, 2010 5:38 PM | Feedback (6)

ValidationResult - Specifying Member Names

The System.ComponentModel.DataAnnotations.ValidationResult class was created for RIA Services, and it was introduced in Silverlight 3.0 and then added into .NET 4.0.  A ValidationResult represents a validation error condition, specifying the error message and, optionally, any member names that the error corresponds to.  If you use the [Required] attribute, the [Range] attribute, [StringLength], or any of the other provided ValidationAttribute classes, then ValidationResult instances are created to represent any validation failures.  If you have used the [CustomValidation] attribute or if you have derived from ValidationAttribute yourself, you have likely returned an instance of ValidationResult in your code, or ValidationResult.Success if validation...

posted @ Wednesday, February 24, 2010 11:42 PM | Feedback (1)

My Stretch Goal: To Ship RIA Services Source Code

When I laid out my commitments for the current fiscal year, I included “Ship RIA Services Source Code” as a stretch goal.  Pulling this off will require a ton of effort.  I’ll have to work with management up several levels, with our legal department, and with dozens of others to pull it off.  There will also be a very significant amount of engineering required to make it happen too.  So I’m trying to figure out how valuable this would be to our customers. Please go rate the value here: http://twtpoll.com/zfln78 I’d also like to hear comments backing up...

posted @ Thursday, January 21, 2010 12:14 AM | Feedback (9)

(Not) Doing Back Flips with DomainDataSource [SubmitChanges sends user to first page]

When changes are successfully submitted and you have paging enabled, it’s quite possible that some of the entities that have been edited now belong to a different page.  Say for instance you are viewing employees ordered by last name, and you edit one of the employees to change their last name, moving them from Jones to Adams.  After submitting changes, what should happen?  Should Adams continue to show up on the 6th page, or should the data be refreshed to place everyone where they belong? A few months ago, we made the decision to invoke a fresh load after...

posted @ Saturday, November 21, 2009 9:40 AM | Feedback (2)

DomainDataSource Error Handling

With the RIA Services July 2009 Preview release, we heard significant feedback about the DomainDataSource error handling story.  The biggest problem was when errors occurred during Load() or SubmitChanges(), server-side errors would be silently swallowed unless you opted into the LoadError, LoadedData, and SubmittedChanges events, and explicitly checked for errors.  With the PDC release, we've change this behavior, among others related to error handling. Different Error Conditions The DomainDataSource can encounter errors in several different ways: Load() is called when its prerequisites are not yet met.  For instance, there is no DomainContext specified, the...

posted @ Thursday, November 19, 2009 8:29 PM | Feedback (16)

Building ContosoSales - The RIA Services Keynote Demo

During Scott Guthrie’s keynote at PDC09 (starting around 1:28:00), Scott Hanselman presented a demo that highlighted Visual Studio 2010, Silverlight 4, RIA Services, and lots of great new tooling that ties all of these products together.  I wanted to show you how you can build the same application using installations that are available today. Machine Setup You’ll need to install Visual Studio 2010 Beta 2 if you haven't already.  If you have a previous release of RIA Services already installed, you’ll need to uninstall it before proceeding.  Please note that you want to keep the Silverlight 3 SDK installed...

posted @ Wednesday, November 18, 2009 10:04 AM | Feedback (16)

DomainDataSourceView API (DomainDataSource.DataView)

DomainDataSource has two properties for getting the data out of it: Data and DataView.  The Data property is what’s intended for exposure in Binding scenarios, for instance binding a DataGrid to the DomainDataSource.  This property is typed very simply as an IEnumerable.  The DataView property however is intended to be used for programmatic access to the entities exposed by the DomainDataSource.  While the two properties currently return the same collection instance, this might not always be true, so it’s good to properly set the expectations of these two properties.  If you need to work with the collection from the DomainDataSource,...

posted @ Monday, November 16, 2009 3:58 PM | Feedback (2)

DomainDataSource DataPager PageSize Pitfall

During the PDC release milestone of RIA Services, we discovered an error from DomainDataSource when using AutoLoad="True" and when using a DataPager bound to the DomainDataSource’s Data property.  We found that when the PageSize property is specified on the DataPager and not on the the DomainDataSource itself, an exception would often (but not always) be thrown from DomainDataSource, indicating that a load could not be invoked while another load was in progress.  The reason for this will actually interest you most if you use AutoLoad set to False. The issue is easiest to explain with a series of events...

posted @ Monday, November 16, 2009 3:12 AM | Feedback (3)

DomainDataSource – Single Record Results

While the DomainDataSource is most often used for loading entire sets of records, it can also be used for loading a single record result.  This is a topic I’ve seen a few people talk about, assuming it’s a difficult thing to do, and even creating solutions for a problem that doesn’t exist.  I want to dispel the myth here: DomainDataSource can in fact be used to easily bind to a single record result. Let’s create a DomainService that has a method to get the most recent error from the AdventureWorks database: ...

posted @ Tuesday, November 10, 2009 10:33 AM | Feedback (2)

Add/Remove with DataForm and RIA Services

Tom Beeby posted a topic on the RIA Services forums about adding a new entity via the DataForm buttons.  Specifically, he pointed out a problem where the DataForm does not light up the Add/Remove buttons when bound to an EntityList from your DomainContext.  To exacerbate the problem, it turns out that binding to an EntityCollection<T> from RIA Services won’t let you Add or Remove either.  I’ve dug into this problem with some team members, and we’ve identified the cause of the problem. To be clear, binding a DataForm and getting Add/Remove support works just fine when you’re binding to...

posted @ Friday, August 14, 2009 1:50 AM | Feedback (20)

DomainDataSource.DataView

There have been a couple of discussions on the .NET RIA Services Forums regarding the DomainDataSource.DataView property.  Colin Blair tossed in a comment that relates to something we’re working on: This looks like as good a place as any to say I would like to see the actual object behind IEditableCollectionView exposed publically. … Right now, the DomainDataSource’s Data and DataView properties are returned as interfaces: Data is an IEnumerable, and DataView is an ICollectionView.  But behind the scenes, both of these properties return an instance of an EntityCollectionView,...

posted @ Tuesday, July 21, 2009 5:41 PM | Feedback (3)

DomainDataSource – Defining Its Limits

With the .NET RIA Services July 2009 Preview, the DomainDataSource now enables some scenarios that were previously blocked.  Most namely, we now allow you to change your current page while there are pending changes in the data.  Editing and paging seemed like a common enough scenario that we wanted to enable it, so we’ve done so in the recent drop. There are actually many scenarios opened up right now that we’re reviewing.  I’ll be frank: many of the following scenarios are probably doing really wonky things in the current bits.  So here’s your chance to help us determine how these scenarios...

posted @ Tuesday, July 14, 2009 3:45 AM | Feedback (12)

Async Validation with .NET RIA Services and DataForm

The Birth of QuickSilverlight.Validation Over on the .NET RIA Services forums, “SilverlightRIA” asked about performing asynchronous validation with .NET RIA Services and the Silverlight Toolkit’s DataForm.  He wanted to intercept the Commit from the DataForm and invoke his async validation, integrating the results into the DataForm’s validation UI.  This was an interesting scenario so I put some time into a solution for it this week.  The result is a library that I’m calling QuickSilverlight.Validation. Integrating Validation Results into DataForm It took a few hours of digging to find a way to get the async validation results to...

posted @ Saturday, July 11, 2009 5:05 AM | Feedback (8)

Validation Exceptions in Silverlight

With the Silverlight 3 Beta SDK and .NET RIA Services, a lot of people are starting to utilize the System.ComponentModel.DataAnnotations library to add validation metadata to their entities.  Something that has tripped up some people is the use of exceptions for validation errors, where Visual Studio breaks with a user unhandled exception. As Keith Jones reported, Silverlight 3 uses exceptions to notify controls when validation has failed.  This means that many users will see Visual Studio break when these exceptions occur and be led to believe something has gone wrong.  But everything’s doing what it should.  If you hit...

posted @ Wednesday, April 01, 2009 10:33 AM | Feedback (4)

.NET RIA Services – Implementing Custom Interfaces

.NET RIA Services allows you to write code on the server in an ASP.NET project, and have it available within a Silverlight application hosted by that web project.  Using build-time code generation, your entity types in the server project become available within the client project.  You can get .NET RIA Services today and provide feedback on the forums. Well, I am working on a scenario where I needed to have an entity implement a custom interface on both the server and the client.  I immediately wondered, “How on Earth will the code generation know to propagate my interface implementation...

posted @ Monday, March 30, 2009 1:49 PM | Feedback (6)

Silverlight 3 and .NET RIA Services

Ever since I started at Microsoft, I’ve been part of a team working to deliver a lot of things that are hitting the streets today.  It’s been a wild ride and it’s great to see our work going public. Here is some of what is most exciting for me to see in public: .NET RIA Services Validation Navigation ChildWindow There’s going to be a lot to take in over the next couple of days with the MIX sessions, but I look forward to...

posted @ Wednesday, March 18, 2009 1:10 PM | Feedback (0)