erotik film
bodyheat full moves www xxx kajal video la figa che sborra ver video de sexo porno
Luxury replica watches
sex
asyabahis
escort antalya

** THIS SITE IS AN ARCHIVE ** - New Content is at:
BlazorHelpWebsite.com

Apr 23

Written by: Michael Washington
4/23/2012 8:39 PM  RssIcon

image

Consuming OData in Visual Studio LightSwitch in Visual Studio 2011 is very easy. When you consume an OData service in LightSwitch, its Entities that you import behave like any other LightSwitch data source (such as Internal Entities, external SQL tables, and WCF RIA Services). This allows you to easily create mash-ups where you combine different data sources to create an application.

In this example, we will create an application that allows us to add our own reviews to the movies in the Netflix catalog. To do this, we will consume the Netflix OData service in our LightSwitch application. You can get information about the Netflix OData service at this link: http://developer.netflix.com/docs/oData_Catalog.

Connect To The Netflix OData Service

image

We first create a new LightSwitch project.

image

We right-click on Data Sources in the Solution Explorer and select Add Data Source.

image

We select OData Service and click Next.

image
We enter the URL to the Netflix OData service and click the Test Connection button.

image

The Test Connection box will show, and ask us to select a entity to test.

image

After testing, we return to the Attach Data Source Wizard and select Next.

image

We select all the entities and click Finish.

image

We will receive warnings, but clicking Continue will import the entities.

image

We open the Title entity and in its Properties, set the Summary Property to the ShortName column.

Create The Screen

image

Now, we right-click on the Screens folder in the Solution Explorer, and select Add Screen.

image

We create a List and Details Screen.

image

The Screen will show in the designer.

image

Now we press the F5 key to run the application.

We have a working application that can browse the Netflix catalog.

Create The Mash-up

image

We close the running application, and return to Visual Studio.

We now add a new Table (Entity).

image

We create a table called MyReview with two fields:

ReviewText – To hold the text of our review of the movie. We clear the Maximum Length field in the Properties for this field to allow for a long review.

MovieTitle – To hold the title of the movie.

We then click the Relationship button.

image

We create the relationship.

image

We then create an Editable Grid Screen for the table.

image

We remove Movie Title.

The title will be shown in the Title field.

image

We change the control for the Title field to Modal Window Picker because it will allow us to easily choose a movie from the large list of movies.

The default Auto Complete Box would attempt to load all the movies (over 1000 movies) in a single drop down.

image

We right-click on the Add button and select Override Code.

We do this to prevent the automatic popup from opening because that popup will try to show all the movies in the automatically created drop down.

image

We add one line of code to cause a blank row to be added to the grid when the button is pressed:

MyReviews.AddNew();

image

When we run the application we now have our mash-up!

image

Notice that we get a searchable, page able, movie selector by simply selecting the Modal Window Picker for the Title field.

 

Also See

Shape Your LightSwitch OData Using WCF RIA Services

A Full CRUD DataJs and KnockoutJs LightSwitch Example Using Only An .Html Page

A Full CRUD LightSwitch JQuery Mobile Application

Calling LightSwitch 2011 OData Using Server Side Code

Using The OData Explorer with LightSwitch OData

Learn How To Make OData Calls In LightSwitch 2011

Accessing Your Visual Studio 2011 LightSwitch Application Using OData

Download Code

The LightSwitch project is available at:

http://lightswitchhelpwebsite.com/Downloads.aspx

Tags: OData
Categories:
Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation