When building enterprise mobile apps, you typically need to deal with several challenges related to data management such as:
- Creating / managing data model and data services.
- Accessing and manipulating data to the data services.
- Tracking and saving data changes.
- Validating data.
- Synchronizing data.
- Securing data access.
Crosslight provides a complete solution to elegantly address these challenges by leveraging industry's latest technologies and advanced data management built with modern design pattern.
Enterprise Data Access Overview
Introducing Crosslight Entity Services, it provides a comprehensive solution for enterprise data access which comprises of three major components: client component, server component, and designer extension integrated to Visual Studio. These components are designed to work together seamlessly, allowing you to easily build data-driven mobile apps that work across multiple platforms.
The following diagram illustrates an overview of Crosslight enterprise data access components.
Designed with solid architecture and design pattern, Crosslight entity services lets you rapidly build complex data-driven mobile apps through streamlined workflows and intuitive development experience.
The key components of Crosslight entity services and the recommended development workflow is explained below.
Entity Designer Extensions for Visual Studio
The first step in building enterprise data access is designing the domain model that will be used in the apps. Crosslight provides an intuitive entity designer which extends on Visual Studio 2012 and 2013, enabling you to easily create, design and manage your domain model and entity context. In this stage, you will typically choose the database that you would like to work with, then simply add the tables, views or functions into the designer.Built on top of Microsoft Entity Framework, Crosslight Entity Designer automatically generates domain models and entity context that can be consumed in both client and server projects. In addition, the code generator is also able to automatically generate the entity controllers that comply with ASP.NET Web API and MVC 5, providing full data access support to each entity model.
- Server Entity Service
The generated entity services are REST services with OData support, so you can perform any data manipulation supported by OData query such as sorting, filtering, paging, include and selection. The entity service will also contain save changes methods that accept collection of entity to be inserted, deleted or updated to the actual database. All server data operations are automatically handled by the server entity service, resembled in the Intersoft.Data.WebApi assembly.
- Client Entity Service
You can use the entity model generated by Crosslight entity designer by linking the generated files into your client side projects, typically in the shared (Core) project. By default, the entity models are automatically linked to the Core project when you added a new Crosslight Entity Model item from Visual Studio. This entity model works in conjunction with EntityContainer to perform client side data operation tasks such as data validation, tracking changes and preparing the entity that will be sent to the server entity service for save changes process. The client entity services and functionalities are resembled in the Intersoft.Crosslight.Data assembly.
Creating Entity Model And Services With Crosslight Entity Designer Extensions
In order to easily create and manage your entity model and entity services, you can use Crosslight Entity Designer Extensions which is built upon Microsoft Visual Studio Entity Designer (ADO.NET Entity Data Model Designer).
Accessing Entity Services
The generated entity services from Crosslight Entity Designer Extensions is an API Controller leveraging ASP.NET Web API. You can use Crosslight RestClient to access this entity service similar with accessing other REST service.
To learn more how to access the entity service and perform data manipulation such as sorting, paging and filtering, see Accessing Entity Services
Securing Entity Services
Securing entity services is critical to protect information-sensitive resources. There are two additional tasks before the request can be granted access to entity controller, which are authentication and authorization. You will need to restrict your API controller so that only authenticated and authorized user can access the protected resources.
To learn more how to secure entity services, see Securing Entity Services.
Tracking And Saving Changes
Tracking and saving changes are common operations that are typically handled in the client side. Using Crosslight entity services, data retrieved from entity services are serialized to EntityBase class. This entity model can work in conjunction with EntityContainer to track any changes that occurs in client side. To learn more how to track and save changes with EntityContainer, see Tracking and Saving Changes
Validating data is a process of ensuring whether the modified data is valid before sending it to the data service. Crosslight provides a data validation framework that allows you to easily specify data validation for specific property using attributes. To learn more about these validation attribute, see Validating Data.
Most applications typically require access to a remote data source, either on their own application data service or public data services. The access to these data services is highly dependent on data connectivity. When the data connectivity is unstable or hard to come by, the application will fail to function.
To address this issue, enterprise apps should be designed to support offline data storage where all or portion of the retrieved data are stored in the device's local storage. This enables users to continue working with the apps without concerning the connection status. This is made possible since the application is able to load previously stored data from the local storage.
This scenario introduce the needs of two-way data synchronization where the application should synchronize the offline data to the server, as well as retrieving new data back to the client. There are various ways to implement data synchronization in enterprise apps. For more information, see Synchronizing Data.