Let's go ahead and add some logging now,
to our data table for our Azure Mobile Service.
If I click on To-Do Item, and I click on
Script, you notice I have all my crud operations here.
So I have Insert, Update, Delete, and Read, and I can select any one of these.
If you're unfamiliar with no j s that's the syntax that your seeing
here, and in fact, you put in different no j s functionality here.
So, we could do additional web requests, and pull in
information from other services all before that data gets exicuted.
So, what I'm going to do, is I'm going to pull up the insert request.
And I'm going to do a console.log and we're going to say added item plus,
and the item coming across as text. Let's go ahead and save this, dismiss
it.
And now if we go back to our
application when we run this Information has been logged.
We'll say save, go back to the portal.
We'll go over to logs and you'll notice I have more information.
I can click on the source with to-do item insert.,
it'll take me directly to what script is doing there.
If I go back, I can select the message and then hit details.
You'll Added Item, and then, Information has been logged,
is the information that we hit to the database.
The level is set at Information.
But if we come back to Data, select To-Do Item, go into the script, we could do
a, error here as well, save this, and we'll add some additional text spacing. Save.
Information.
Should be an error. And we'll hit save.
When we go back to our portal, you'll notice
that the level is now showing up as an error.
As a developer, this becomes extremely important.
You have the capability to quickly go in, edit all of your data operations in the
cloud, And have the ability to log anything
that's coming across, from all of your mobile devices.
If I go ahead and I click on configure,
you'll see I get a couple options.
One of them is the ability to go directly to
our SQL server database and take a look inside that data.
I'm going to click on that.
And I am going to select manage at the bottom, this is going to give us a prompt
to go ahead and enter an IP address firewall
rule so that we can access the database securely.
If that rule wasn't in place, we would get an access denied.
This is that
only devices that we have approved will be able to access our database.
I'm going to say yes.
It's going to open up the management portal.
Now this management portal is written using Silverlight.
If you do not have the Silverlight plugin you may be prompted to install it.
I'm going to go ahead and enter my credentials.
And log on.
And we're going to get a bunch of properties.
So if I click univ db and design. You'll see I have a
to do item table.
I can click Edit and I get all of the properties of the table, so you can see
the dynamic schema has setup, id to be a bigint, text to be an nvarchar,
and complete to be a bit, even though
these variables were probably set up as strings and
bool, inside of the language, everything has been
set inside of our SQL server database for us.
We can also run queries and
do administration of our database all through this cloud based IDE.
Let's go ahead and close the portal.
Say leave this page.
We'll come back into our mobile service dashboard.
We'll go over to configure, and you'll see we also
have options here for monitoring, and turning the dynamic scheme off.
One of the additional things currently in preview is auto scale.
If I hit scale,
You'll see I currently have the ability to change my sequel server
database from 20 megabytes, which is free to 1 gig or 5 gigs.
I can also switch to business class and move from
10 gigs all the way up to a 150 gigs.
What's important to remember here is that everything happens in place.
So none of my data is lost, if I choose to upgrade my service.
If I move between
the tiers, switching from standard, or to premium,
you'll see I suddenly get an option for auto-scale.
I'm going to say auto-scale on, and I'm going to say,
I want to move up my instances, between 2 and 5.
This will allow us to go ahead and increase the number of VM that are going
to respond to any given API call. It'll both scale up and scale down.
So if I'm not getting as much API calls as
I was before, I'll actually move lower on that scale.
So I may move from 5 instances to 3 instances.
This is a great way to automatically scale
up and service API requests to your mobile service.