SlideShare uma empresa Scribd logo
1 de 18
Baixar para ler offline
Mobile Services
 Data Storage



                            Radu Vunvulea
                     vunvulear@gmail.com
         http://vunvulearadu.blogspot.com
Who am I?
        {
            “name” : “Radu Vunvulea,
            “company” : “iQuest”,
            “userType” : “enthusiastic”
            “technologies” : [ “.NET”, “JS”, “Azure”, “Web”,
                “Mobile”, “SL” ],
            “w8experience” : [ “2 LoB App”, “1 Travel App”],
            “blog” : “vunvulearadu.blogspot.com”,
            “email” : ”vunvulear@gmail.com”,
            “socialMedia” :
                {
                         “twitter” : “@RaduVunvulea”,
                         “fb” : “radu.vunvulea”
                }
        }
Windows Azure Mobile Services
• This is the topic for today meeting
Agenda
•   Features
•   Pricing
•   Account setup
•   Account configuration for storing data
•   What kind of data can be added
•   Custom scripts
•   Authentication
•   Available API
•   Demo
Features of Mobile Services
• User authentication
    •   Windows Live
    •   Facebook
    •   Google
    •   Twitter
• Store data in the cloud
    •   Windows Azure Storage
• Push notification infrastructure
    •   All the service is build in in Windows Azure
Pricing of Mobile Services
• Free package in the 90 days trial:
    •   Outbound traffic included 165MB
    •   Maximum 10 mobile services
• Reserved instance model:
    •   3 dedicated servers (small instances, pay-as-you-go model)
    •   100 mobile services
    •   Outbound data transfer will be paid




• Price available during preview can change in the final release
Pricing of Mobile Services
• Free package in the 90 days trial:
    •   Outbound traffic included 165MB
    •   Maximum 10 mobile services
• Reserved instance model:
    •   3 dedicated servers (small instances, pay-as-you-go model)
    •   100 mobile services
    •   Outbound data transfer will be paid




• Price available during preview can change in the final release
Setup your account
• Create a new mobile service from the “New/Mobile Service/Create”
• A unique name of the mobile service need to be created
• If we need a fresh database can be created or an existing one can be
  used (if is in the same region)
    •   After creating the database, we can use it as a normal database
• The service can be active for one of the following platform:
    •   IOS
    •   Windows Phone 8
    •   Windows Store
• For each of the platform, after creating the mobile service, we can
  download the project that contains all the configurations
Configure environment to store data
• From the management portal each service contains a tab named
  “Data”
• We can managed all the tables that we have
    •   Create/Edit/Delete each table
    •   See the content of each table
• For each table, we can set the rights of each user of the given table:
    •   Anybody with the application key
    •   Everyone
    •   Only authenticate user
    •   Only scripts and admin
• This rights can be different for CRUD operations
What kind of data can be added?
• Any kind of serializable data
• Each entity have to be decorated with DataContract and
   DataMember attributes
• It is recomanded to use the Name field of DataMember
[DataContract]
public class MyFoo
{
         public int Id { get;set;}

       [DataMember(Name = "Name"]
       public string Name { get;set;}
}
The “Id” field don’t need to be decorated with DataMember attribute
Custom scripts
• Each CRUD operation can contain a custom script that is executed
   on the server side
• This scripts can be for validation purposes or to add/set custom
   fields
• Language: JavaScript
function insert(item, user, request) {
  if (item.name == "Tom") {
      request.respond(statusCodes.BAD_REQUEST, 'Tom name cannot be
added');
  } else {
      request.execute();
  }
}
• When this kind of error appear, the client need to catch
   “MobileServiceInvalidOperationException” exception
Custom scripts
• Each script can have helper functions
• Base action that need to be done by a script
    •   execute – execute the given action
    •   respond – send a response back to the client
• We cannot define global variable, each call is executed in a separate
  request
• Some of the base modules are from node.js
    • Example: we can make a request to another web-service to check data
    function insert(item, user, request) {
      var request = require('request');
      request('http://myFoo.com/Services/validate', function(err, response, body) {
      ...
      });
    }
Custom scripts
Catch the exception on the client
try
{
     await myTable.InsertAsync(item);
     items.Add(item);
}
catch (MobileServiceInvalidOperationException e)
{
        Trace.Write("Error: " + e.Reponse.Content);
}
Control user access to data
• Define custom scripts that check if the given user id has rights to
  access his data

function insert(item, user, request) {
  item.userId = user.userId;
  request.execute();
}
function read(query, user, request) {
   query.where({ userId: user.userId });
   request.execute();
}
• We need to store the user id.
• Each user will have a unique user id
• The user id is generated automatically by the system
•  We cannot store this scripts in our source control system
How to work with data
• Define custom scripts that check if the given user id has rights to
  access his data
App.MobileService.GetTable<MyEntity>()
• Before this we need to create a table with the same name
• Update: table.UpdateAsync(entity)
• Delete: table.DeleteAsync(entity)
• Insert: table.InsertAsync(entity)
• Fetch with data:
    •   Where
    •   Take
    •   Skip
    •   OrderBy
    •   Select
    •   ThenBy
    •   ToListAsync
Demo
Mobile services on windows azure (part2)
THE END




                        Radu Vunvulea
                 vunvulear@gmail.com
     http://vunvulearadu.blogspot.com

Mais conteúdo relacionado

Mais procurados

JavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EEJavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EERodrigo Cândido da Silva
 
Introduction to j query
Introduction to j queryIntroduction to j query
Introduction to j querythewarlog
 
Getting Started with Javascript
Getting Started with JavascriptGetting Started with Javascript
Getting Started with JavascriptAkshay Mathur
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comMongoDB
 
Thinkin' Tags - Rapid Prototyping of CSS Layouts
Thinkin' Tags - Rapid Prototyping of CSS LayoutsThinkin' Tags - Rapid Prototyping of CSS Layouts
Thinkin' Tags - Rapid Prototyping of CSS Layoutsdjesse
 
Building Rich Internet Apps with Silverlight 2
Building Rich Internet Apps with Silverlight 2Building Rich Internet Apps with Silverlight 2
Building Rich Internet Apps with Silverlight 2Microsoft Iceland
 
Building your First MEAN App
Building your First MEAN AppBuilding your First MEAN App
Building your First MEAN AppMongoDB
 

Mais procurados (12)

Working with GIT
Working with GITWorking with GIT
Working with GIT
 
Offline Html5 3days
Offline Html5 3daysOffline Html5 3days
Offline Html5 3days
 
JavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EEJavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EE
 
Introduction to j query
Introduction to j queryIntroduction to j query
Introduction to j query
 
Introduction to j_query
Introduction to j_queryIntroduction to j_query
Introduction to j_query
 
Getting Started with Javascript
Getting Started with JavascriptGetting Started with Javascript
Getting Started with Javascript
 
Streaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.comStreaming Data Pipelines with MongoDB and Kafka at ao.com
Streaming Data Pipelines with MongoDB and Kafka at ao.com
 
Thinkin' Tags - Rapid Prototyping of CSS Layouts
Thinkin' Tags - Rapid Prototyping of CSS LayoutsThinkin' Tags - Rapid Prototyping of CSS Layouts
Thinkin' Tags - Rapid Prototyping of CSS Layouts
 
Drupal migrate-june2015
Drupal migrate-june2015Drupal migrate-june2015
Drupal migrate-june2015
 
Building Rich Internet Apps with Silverlight 2
Building Rich Internet Apps with Silverlight 2Building Rich Internet Apps with Silverlight 2
Building Rich Internet Apps with Silverlight 2
 
JavaCro'15 - Service Discovery in OSGi Beyond the JVM using Docker and Consul...
JavaCro'15 - Service Discovery in OSGi Beyond the JVM using Docker and Consul...JavaCro'15 - Service Discovery in OSGi Beyond the JVM using Docker and Consul...
JavaCro'15 - Service Discovery in OSGi Beyond the JVM using Docker and Consul...
 
Building your First MEAN App
Building your First MEAN AppBuilding your First MEAN App
Building your First MEAN App
 

Semelhante a Mobile services on windows azure (part2)

Mobile services on windows azure (part3)
Mobile services on windows azure (part3)Mobile services on windows azure (part3)
Mobile services on windows azure (part3)Radu Vunvulea
 
Codemotion Berlin-Mobile Services
Codemotion Berlin-Mobile ServicesCodemotion Berlin-Mobile Services
Codemotion Berlin-Mobile ServicesMike Benkovich
 
Scalability in cloud applications
Scalability in cloud applicationsScalability in cloud applications
Scalability in cloud applicationsRadu Vunvulea
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchMongoDB
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB
 
Cnam cours azure zecloud mobile services
Cnam cours azure zecloud mobile servicesCnam cours azure zecloud mobile services
Cnam cours azure zecloud mobile servicesAymeric Weinbach
 
Cloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps with AzureCloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps with AzureKen Cenerelli
 
World Azure Day Mobile Services Presentation
World Azure Day Mobile Services PresentationWorld Azure Day Mobile Services Presentation
World Azure Day Mobile Services PresentationDmitri Artamonov
 
Mobile services on windows azure (part1)
Mobile services on windows azure (part1)Mobile services on windows azure (part1)
Mobile services on windows azure (part1)Radu Vunvulea
 
AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...
AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...
AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...AwsReinventSlides
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOSjimmyatmedium
 
Cloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps  with AzureCloud Powered Mobile Apps  with Azure
Cloud Powered Mobile Apps with AzureKris Wagner
 
An Introduction to webOS
An Introduction to webOSAn Introduction to webOS
An Introduction to webOSKevin Decker
 
2015.04.23 Azure Mobile Services
2015.04.23 Azure Mobile Services2015.04.23 Azure Mobile Services
2015.04.23 Azure Mobile ServicesMarco Parenzan
 
Tutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchTutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchMongoDB
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in schoolMichael Galpin
 
Windows Azure mobile services - Kolkata - 28 June 2015
Windows Azure mobile services - Kolkata - 28 June 2015Windows Azure mobile services - Kolkata - 28 June 2015
Windows Azure mobile services - Kolkata - 28 June 2015Kunal Chowdhury
 
What's New for the Windows Azure Developer? Lots! (July 2013)
What's New for the Windows Azure Developer?  Lots! (July 2013)What's New for the Windows Azure Developer?  Lots! (July 2013)
What's New for the Windows Azure Developer? Lots! (July 2013)Michael Collier
 
Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...
Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...
Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...DataArt
 

Semelhante a Mobile services on windows azure (part2) (20)

Mobile services on windows azure (part3)
Mobile services on windows azure (part3)Mobile services on windows azure (part3)
Mobile services on windows azure (part3)
 
Codemotion Berlin-Mobile Services
Codemotion Berlin-Mobile ServicesCodemotion Berlin-Mobile Services
Codemotion Berlin-Mobile Services
 
Scalability in cloud applications
Scalability in cloud applicationsScalability in cloud applications
Scalability in cloud applications
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
 
Cnam cours azure zecloud mobile services
Cnam cours azure zecloud mobile servicesCnam cours azure zecloud mobile services
Cnam cours azure zecloud mobile services
 
Cloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps with AzureCloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps with Azure
 
World Azure Day Mobile Services Presentation
World Azure Day Mobile Services PresentationWorld Azure Day Mobile Services Presentation
World Azure Day Mobile Services Presentation
 
Mobile services on windows azure (part1)
Mobile services on windows azure (part1)Mobile services on windows azure (part1)
Mobile services on windows azure (part1)
 
AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...
AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...
AWS re:Invent 2016: Content and Data Platforms at Vevo: Rebuilding and Scalin...
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOS
 
Cloud Powered Mobile Apps with Azure
Cloud Powered Mobile Apps  with AzureCloud Powered Mobile Apps  with Azure
Cloud Powered Mobile Apps with Azure
 
An Introduction to webOS
An Introduction to webOSAn Introduction to webOS
An Introduction to webOS
 
2015.04.23 Azure Mobile Services
2015.04.23 Azure Mobile Services2015.04.23 Azure Mobile Services
2015.04.23 Azure Mobile Services
 
Tutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchTutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB Stitch
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in school
 
Windows Azure mobile services - Kolkata - 28 June 2015
Windows Azure mobile services - Kolkata - 28 June 2015Windows Azure mobile services - Kolkata - 28 June 2015
Windows Azure mobile services - Kolkata - 28 June 2015
 
What's New for the Windows Azure Developer? Lots! (July 2013)
What's New for the Windows Azure Developer?  Lots! (July 2013)What's New for the Windows Azure Developer?  Lots! (July 2013)
What's New for the Windows Azure Developer? Lots! (July 2013)
 
AWS IoT Deep Dive
AWS IoT Deep DiveAWS IoT Deep Dive
AWS IoT Deep Dive
 
Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...
Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...
Антон Бойко (Microsoft Azure MVP, Ukrainian Azure Community Founder) «Azure M...
 

Mobile services on windows azure (part2)

  • 1. Mobile Services Data Storage Radu Vunvulea vunvulear@gmail.com http://vunvulearadu.blogspot.com
  • 2. Who am I? { “name” : “Radu Vunvulea, “company” : “iQuest”, “userType” : “enthusiastic” “technologies” : [ “.NET”, “JS”, “Azure”, “Web”, “Mobile”, “SL” ], “w8experience” : [ “2 LoB App”, “1 Travel App”], “blog” : “vunvulearadu.blogspot.com”, “email” : ”vunvulear@gmail.com”, “socialMedia” : { “twitter” : “@RaduVunvulea”, “fb” : “radu.vunvulea” } }
  • 3. Windows Azure Mobile Services • This is the topic for today meeting
  • 4. Agenda • Features • Pricing • Account setup • Account configuration for storing data • What kind of data can be added • Custom scripts • Authentication • Available API • Demo
  • 5. Features of Mobile Services • User authentication • Windows Live • Facebook • Google • Twitter • Store data in the cloud • Windows Azure Storage • Push notification infrastructure • All the service is build in in Windows Azure
  • 6. Pricing of Mobile Services • Free package in the 90 days trial: • Outbound traffic included 165MB • Maximum 10 mobile services • Reserved instance model: • 3 dedicated servers (small instances, pay-as-you-go model) • 100 mobile services • Outbound data transfer will be paid • Price available during preview can change in the final release
  • 7. Pricing of Mobile Services • Free package in the 90 days trial: • Outbound traffic included 165MB • Maximum 10 mobile services • Reserved instance model: • 3 dedicated servers (small instances, pay-as-you-go model) • 100 mobile services • Outbound data transfer will be paid • Price available during preview can change in the final release
  • 8. Setup your account • Create a new mobile service from the “New/Mobile Service/Create” • A unique name of the mobile service need to be created • If we need a fresh database can be created or an existing one can be used (if is in the same region) • After creating the database, we can use it as a normal database • The service can be active for one of the following platform: • IOS • Windows Phone 8 • Windows Store • For each of the platform, after creating the mobile service, we can download the project that contains all the configurations
  • 9. Configure environment to store data • From the management portal each service contains a tab named “Data” • We can managed all the tables that we have • Create/Edit/Delete each table • See the content of each table • For each table, we can set the rights of each user of the given table: • Anybody with the application key • Everyone • Only authenticate user • Only scripts and admin • This rights can be different for CRUD operations
  • 10. What kind of data can be added? • Any kind of serializable data • Each entity have to be decorated with DataContract and DataMember attributes • It is recomanded to use the Name field of DataMember [DataContract] public class MyFoo { public int Id { get;set;} [DataMember(Name = "Name"] public string Name { get;set;} } The “Id” field don’t need to be decorated with DataMember attribute
  • 11. Custom scripts • Each CRUD operation can contain a custom script that is executed on the server side • This scripts can be for validation purposes or to add/set custom fields • Language: JavaScript function insert(item, user, request) { if (item.name == "Tom") { request.respond(statusCodes.BAD_REQUEST, 'Tom name cannot be added'); } else { request.execute(); } } • When this kind of error appear, the client need to catch “MobileServiceInvalidOperationException” exception
  • 12. Custom scripts • Each script can have helper functions • Base action that need to be done by a script • execute – execute the given action • respond – send a response back to the client • We cannot define global variable, each call is executed in a separate request • Some of the base modules are from node.js • Example: we can make a request to another web-service to check data function insert(item, user, request) { var request = require('request'); request('http://myFoo.com/Services/validate', function(err, response, body) { ... }); }
  • 13. Custom scripts Catch the exception on the client try { await myTable.InsertAsync(item); items.Add(item); } catch (MobileServiceInvalidOperationException e) { Trace.Write("Error: " + e.Reponse.Content); }
  • 14. Control user access to data • Define custom scripts that check if the given user id has rights to access his data function insert(item, user, request) { item.userId = user.userId; request.execute(); } function read(query, user, request) { query.where({ userId: user.userId }); request.execute(); } • We need to store the user id. • Each user will have a unique user id • The user id is generated automatically by the system •  We cannot store this scripts in our source control system
  • 15. How to work with data • Define custom scripts that check if the given user id has rights to access his data App.MobileService.GetTable<MyEntity>() • Before this we need to create a table with the same name • Update: table.UpdateAsync(entity) • Delete: table.DeleteAsync(entity) • Insert: table.InsertAsync(entity) • Fetch with data: • Where • Take • Skip • OrderBy • Select • ThenBy • ToListAsync
  • 16. Demo
  • 18. THE END Radu Vunvulea vunvulear@gmail.com http://vunvulearadu.blogspot.com

Notas do Editor

  1. COM
  2. COM
  3. COM
  4. COM
  5. COM
  6. COM
  7. COM
  8. COM
  9. COM
  10. COM
  11. COM
  12. COM
  13. COM
  14. COM