It has been a great two weeks since we introduced the Telerik platform. I hope that you have had a chance to watch the keynote introducing the platform and showing how easy it is to use the Platform to build mobile applications. A common question that has come up since we released the Platform, the Telerik website, and the Telerik 3.0 branding has been “What does this mean for my .NET development skills? What about the Telerik .NET tools that I am currently using?”
What this means for your .NET development skills is that you are going to see the benefit of a focused Telerik that is delivering to you a complete platform that allows you to build applications and services with your favorite tools for users on any screen. The DevCraft collection is not going away, in fact, it is becoming even stronger with the addition of Platform resources to support it. Instead of sounding like one of my favorite Brady Bunch characters chanting “Marsha, Marsha, Marsha” , I’m going to show you how the Platform brings great features to our .NET products.
The AppBuilder feature on the Telerik Platform comes with Kendo UI built in. Did you know that you can download editors and extensions to allow you to build applications from your Windows desktop? Click the download button on the top menu of the Platform website and choose AppBuilder.
You will then have the option to download a stand-alone Windows client or a Visual Studio plugin to get started in an environment that you are already comfortable with. In the future we will add more ways to work with the platform. For example, we’re planning to release a command-line interface that will allow any editor to integrate or the hardcore coders to work with the Platform from a console window. Stay tuned for more cool integrations with the Telerik Platform.
First, download the .NET SDK by entering the same download screen as described with AppBuilder and select the ‘Backend Services’ item this time. Select either .NET or Windows Phone depending on your needs:
Choose your project from the drop down list of projects that you have already configured. Click the download button for the appropriate version of .NET that you are using, and then let the fun commence!
If you are constructing applications with .NET 4.0 and later, you can bind our controls to any object. Consider building a repository object with the following syntax to begin trafficking data to Telerik Backend Services:
Now you have the beginning of a Repository object to create, read, update, and delete data in your Backend Services project. The User_ID and Password fields are the user id that you want to authenticate into your application with, and these could be requested from your application’s user. The API Key comes from the API Keys menu on the left side of a Backend Services project.
With this information, you can create classes to match the types that you have created in Backend services. These classes should descend from the Telerik.Everlive.Sdk.Core.Model.Base.DataItem type, so that they can be easily worked with over the service connection. Add a Telerik.Everlive.Sdk.Core.Serialization.ServerType attribute to the class to indicate the name of the content type that the class represents.
For example, check this code snippet from my Activity data-transfer-object class that represents the Activities content type from the sample Friends application:
Of course, my final implementation has references to the other fields in the Activity content type. What is important to note here, is that we are raising the OnPropertyChanged event when the value of the property changes. This prepares the API to know which values have changed when performing updates.
Finally, we can fetch and work with our data with syntax similar to:
Listing 3 - Simple GetById method
With this approach, you can now use the data provided by Backend Services with any of the Telerik controls for any platform: WPF, ASP.NET, WinForms, or Windows 8.
If you are developing apps for Windows Phone, we have you completely covered with a set of controls that make integration a breeze. Check out the CloudDataForm, CloudFeedback, and CloudSettings for controls that simplify the storage of data, feedback, and settings information for your app using our Telerik Backend Services data storage.
Telerik Backend services provides for File storage as well. Fortunately, with the Telerik control sets in ASP.NET and Windows Phone you can easily store and retrieve data using this service. Check out the following controls that we provide that make interacting with your cloud data a breeze:
If you need access to your files stored on Backend services with another platform, we have APIs available in the same .NET SDK for you to be able to make simple calls to the server to fetch and store your files. Uploading is as simple as:
Listing 4 - Upload a File Sample Code
Downloading is just as easy:
There are a number of security options that you can use to protect your application with Telerik Backend Services, and they are all accessible through the .NET SDK. You can easily authenticate your users with a Telerik Backend Services UserId and Password using:
However, if your users you would like to authenticate with Facebook, Google, or their Microsoft account you can easily use those services APIs to retrieve an access token and authenticate with a statement like:
This will take the Facebook access token and retrieve a Telerik access token for use on working with your application hosted on the Platform. Every subsequent request will carry this account into authorization requests for data stored in Backend Services.
If you are a Windows Phone developer, you’re in luck! We’ve already done a bit of the work for you, and there are controls to make this a breeze. Check out the CloudRegistration and CloudLogin controls to allow you to secure your application.
In a .NET application, simply add the following code to be run at startup of the application:
and run the following code when your application stops:
This will report back to your Analytics dashboard a user’s actions, locations, and any errors that are thrown by your application. You can add custom feature tracking by adding the following code when an event occurs that you want to count:
If you are a WPF developer, and you are already using our WPF controls, you’ve got it REAL easy. The new Telerik WPF project wizard will walk you through adding your API key and getting your project configured to track feature usage automatically. Check out this great article from our Carey Payette about how to configure and get Analytics running with our WPF controls.
You can then add custom tracking for features of your application by calling:
At this time, Telerik analytics is not optimized for server-side feature tracking and error reporting. While it is possible to use Analytics in this environment, we do not currently recommend it.
You can learn more about getting started with Telerik Analytics and how to further customize your user tracking features in our helpful Analytics Getting Started documentation.
You can grab your Testing API Key from the dashboard of your Telerik Mobile Test Project. In the top left corner, next to the Test Suites header is an API Key button. Click that and you will be presented with a modal box that you can get your API key from:
Add the following three files from the framework you downloaded to your website in a folder called agent:
You can then enable testing on pages that you want to instrument by adding a reference to the TelerikTestingWebAgent.js.
You can then write, execute, and publish tests just as you would against the iOS and Android frameworks.
If you are looking for a more robust testing tool that can perform performance testing, functional testing, and load testing we recommend that you check out Telerik Test Studio to assist with those tasks.
Telerik has introduced a powerful platform that provides immediate and first class support for mobile and hybrid application development. With a little bit of configuration, all of these features can be used by web developers and most of them can be used by all .NET developers. What’s more, if you currently have a DevCraft complete package, many of the features of the Platform are built in to the various control suites for you to use.
Jeffrey T. Fritz is a Microsoft MVP in ASP.Net and an ASPInsider with more than a decade of experience writing and delivering large scale multi-tenant web applications. After building applications with ASP, ASP.NET and now ASP.NET MVC, he is crazy about building web sites for all sizes on any device. You can read more from Jeffrey on his personal blog or on Twitter at @csharpfritz. Google Profile CodeProject
Subscribe to be the first to get our expert-written articles and tutorials for developers!