Browse by Tags
All Tags »
Mix10 (
RSS)
Continuing in our series , I wanted to touch on how a RIA Services can be exposed your service in JSON . This is very handy for Ajax clients. The great thing is that enabling the JSON endpoint is that it requires NO changes whatsoever to the DomainService. All you need to do is enable it is to add the JSON endpoint in web.config 1: < system.serviceModel > 2: < domainServices > 3: < endpoints > 4: < add name = "JSON" 5: type = "Microsoft.ServiceModel.DomainServices.Hosting.JsonEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 6: < add name = "OData" 7: type = "System.ServiceModel...
Continuing in our series , I wanted to touch on how a RIA Services can be exposed as a Soap\WSDL service. This is very useful if you want to enable the exact same business logic\data access logic is available to clients other than Silverlight. For example to a WinForms application or WPF or even a console application. SOAP is a particularly good model for interop with the Java\JEE world as well. First you need to add a reference to Microsoft.ServiceModel.DomainSerivves.Hosting.EndPoints assembly from the RIA Services toolkit. Then you need to edit the endpoints section of the domainserivces config in web.config file. Below I am showing the SOAP and OData endpoints enabled. < system.serviceModel > < domainServices > < endpoints...
To continue our series , In real business applications our data is often very valuable and as such we need to know who is accessing what data and control certain data access to only users with privilege. Luckily this is very easy to do with RIA Services. For example, say we want to let only authenticated users access our data in this example. That is as easy to accomplish as adding an attribute, see line 2 below. 1: [EnableClientAccess] 2: [RequiresAuthentication] 3: public class DishViewDomainService : LinqToEntitiesDomainService<DishViewEntities> 4: { 5: When we run the application, we now get an error. Clearly you can do a bit better from a user experience angle… but the message...
To continue our series let’s look at data validation our business applications. Updating data is great, but when you enable data update you often need to check the data to ensure it is valid. RIA Services as clean, prescriptive pattern for handling this. First let’s look at what you get for free. The value for any field entered has to be valid for the range of that data type. For example, you never need to write code to ensure someone didn’t type is “forty-two” into a textbox bound to an int field. You also get nice looking and well behaved validation exposure in the UI. Note: if you are not seeing this, ensure that “ValidatesOnExceptions=True” is in the binding expression for the each field Of course...
To continue our series , let’s look at localizing our business applications. In today’s global village, it is often no longer OK to support only one language. Many real world business applications need to support multiple languages. To demonstrate the pattern, let’s look at localizing the Silverlight Business Application Template. You can download the completed solution . Here it is in English side-by-side with a localized version (notice the Hebrew is rendered Right-To-Left correctly): Let’s start by creating a new Silverlight Business Application. Notice there is a server and a client project in the solution. The strings that are needed in both the server and...
I had a great time today in my Mix2010 session on SEO for Silverlight . You can find all the slides (more than I was able to cover in the talk) here . and the the full play-by-play of the demo (include a link to the completed solution). I started off talking why SEO matters Then I talked about three tips You can view the site live by using Bing for “my foodie Explorer Cooking Class with Joe..” or the other guys search engine equally well . ;-) Enjoy! Read More...
To continue our series , let’s look at SEO and Silverlight. The vast majority of web traffic is driven by search. Search engines are the first stop for many users on the public internet and is increasingly so in corporate environments as well. Search is also the key technology that drives most ad revenue. So needless to say, SEO is important. But how does SEO work in a Silverlight application where most of the interesting content is dynamically generated? I will present an application pattern for doing SEO in a Silverlight with the minimum of extra work. There are three fun-and-easy steps to making your Silverlight application SEO friendly. Step 1: Make important content deep linkable Step...
To continue our series , let’s look at updating the data. I have created a Plates.xaml page with very similar structure to the above. For details on how I created this page, check out my PDC 09 demo walk through. Now let’s look at updating the Plate data.. First we will create some default “form” UI by dragging an entity from the datasources window in much the same way we did above. But before we create the UI, notice the order of the fields – it matches the order they will be generated in the UI. They are in alphabetic order, but that is not always what you want. For example, I think Name should be first. To address this, in the server project, open the DishViewService.metadata.cs file and add...
OData is an emerging set of extensions for the ATOM protocol that makes it easier to share data over the web. To show off OData in RIA Services, let’s continue our series . We think it is very interesting to expose OData from a DomainService to facilitate data sharing. For example I might want users to be able to access my data in a rich way in Excel as well as my custom Silverlight client. I’d like to be able to enable that without writing multiple services or duplicating any business or data access logic. This is very easy to enable with RIA Services. In fact it is just a check box away! When you create your DomainService simply check the “Expose OData...
To continue our series , let’s see where the fun comes in my look at how easy that is to consume from the client. First just to help you understand what is happening behind the covers, let’s look at a code-behind solution. In View\Home.xaml put a simple DataGrid on the form. < sdk : DataGrid Name = "dataGrid1" Height = "152" Width = "692" /> Then add these lines of code to Home.xaml.cs 1: var context = new DishViewDomainContext(); 2: this .dataGrid1.ItemsSource = context.Restaurants; 3: 4: context.Load(context.GetRestaurantsQuery()); 5: In line 1, we create a DishViewDomainContext… notice this is the automatically generated (via an MSBuild task) from the DishViewDomainService on the...
More Posts
Next page »