Exposing LightSwitch Application Data
For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.
You can expose data from a published Visual Studio LightSwitch web application as an Open Data (OData) feed for use by other applications. Any application that supports the standard OData protocol can consume the data from both the intrinsic database and also any attached data source. For example, you might want to view LightSwitch application data on a mobile device or in an Excel PivotTable report. For more information about OData, see OData by Example.
Application data is exposed as an OData service (.svc) with a separate endpoint for each data source in a published LightSwitch application. For example, an application that has two data sources, which are named Publishers and Retailers, would expose the following endpoints:
The services are backed by the LightSwitch query and update pipelines, so that you can produce customized services for others to consume. All business logic and security implemented in the application remains in effect for anyone who consumes the data. For example, a user who isn’t authorized to view certain information in the application won’t be able to access it through a service. Any updates to the data from an external client are also subject to the validation and concurrency rules that are defined in the application.
Metadata for the OData service is published on the endpoint and is specific to that data source. Metadata for virtual relationships that are defined outside the data source and metadata for business types aren't exposed.
Authentication for data that's exposed through an OData service is closely aligned to the LightSwitch authentication model, which provides secure access. The following table shows the authorization mapping:
|LightSwitch Authentication Type||OData Authentication Type|
Any concurrency or validation errors that occur on a LightSwitch service are communicated back to a client as a standard concurrency or validation error. For a LightSwitch application that consumes a LightSwitch service, additional information about the entity and conflicting properties will also be included.