Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Getting Started with Data

Getting Started with Data

Using the data store provided by Telerik Platform begins with creating a content type. Content types are sets of data items that have a similar structure.

By creating a content type you are also defining a RESTful service layer that you can consume in the client app. The .NET SDK wraps the RESTful layer to help you consume data more easily and with less lines of code.

In this article you will learn how to create a content type in Telerik Platform and how to connect a .NET app to it.

Steps at a glance:

  1. Create a Content Type
  2. Add Fields
  3. Create Your First Data
  4. Get the App ID for Your App
  5. Add the SDK to a New or Existing Project
  6. Create a Model for Your Data
  7. Initialize the Everlive Instance
  8. Connect to Your Data

Prerequisites

Create a Content Type

Open your Telerik Platform app and navigate to Data > Types. Click the Create a Content Type button.

Create types overview image

Add Fields

You will see the Create a content type dialog. Enter a name for your content type, for example Places.

Each content type has predefined fields in its structure for better administration of the data. You can extend the structure of a content type with additional fields. When you finish defining or editing the structure of a type, click the Save button. You will see the data browser screen for the newly created content type.

Create a content type and fields image

Create Your First Data

You can create your first data item directly from the UI portal. Ensure that the data browser is showing your newly created content type and then click the Add an Item button. Fill in the input fields on the right. Click Save when you are ready.

Create a data item image

Get the App ID for Your App

The App ID is the unique identifier of your Telerik Platform app. You can find it in Settings. It is needed to connect your client app to your Telerik Platform data store.

Get the App ID of your App

You are now ready to connect your client app to data using the various Backend Services client SDKs.

Download the SDK

Open your Telerik Platform account and navigate to the Getting Started > Downloads screen in the top right corner. Click Backend Services to see a list of all available downloads. Choose your desired platform and download the ZIP archive to your local machine.

Downloads overview image

Add the SDK to a New or Existing Project

Unzip the archive with the SDK and include the SDK in your project.

Add the following statement to reference the SDK:

using Telerik.Everlive.Sdk.Core;
Imports Telerik.Everlive.Sdk.Core

Create a Model for your Data

First, you need to create a model representing the server entity. Create a new Place class and construct the model as follows:

using System;
using Telerik.Everlive.Sdk.Core.Model.Base;
using Telerik.Everlive.Sdk.Core.Serialization;

[ServerType("Places")]
class Place : DataItem
{
    private string country;

    public string Country
    {
        get
        {
            return country;
        }
        set
        {
            country = value;
            this.OnPropertyChanged("Country");
        }
    }
}
Imports System
Imports Telerik.Everlive.Sdk.Core.Model.Base
Imports Telerik.Everlive.Sdk.Core.Serialization

<ServerType("Places")>
Friend Class Place
    Inherits DataItem
        Private m_country As String

        Public Property Country() As String
            Get
                Return m_country
            End Get
            Set(ByVal value As String)
                m_country = value
                Me.OnPropertyChanged("Country")
            End Set
        End Property
End Class

Initialize the Everlive Instance

The Everlive object connects the client app to a Telerik Platform app. Initialize it in the entry point of your application in the following manner.

string appId = "your-app-id";
//set UseHttps to false to use HTTP
EverliveAppSettings appSettings = new EverliveAppSettings() { AppId = appId, UseHttps = true };
EverliveApp app = new EverliveApp(appSettings);
Dim appId As String = "your-app-id"
'set UseHttps to false to use HTTP
Dim appSettings As New EverliveAppSettings() With {.AppId = appId, .UseHttps = True}
Dim app As New EverliveApp(appSettings)

Connect to Your Data

The following snippet retrieves all items from the specified content type.

 var result = await app.WorkWith().Data<Place>().GetAll().ExecuteAsync();
 Dim result = Await app.WorkWith().Data(Of Place)().GetAll().ExecuteAsync()

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.