"Azure Services Platform Step by step-3rd" with unarmed play to SQL Data Services (SDS)

Source: Internet
Author: User
Keywords We HTTP can this solution
Tags .net address address bar apple change click code content
SDS is actually very friendly and fun. In this section we will not use any programming language, the Stream cow Trojan will lead everyone, only rely on an SDK called SSDs Explorer gadget to play the SDS, familiar with and implement some of the content of the previous story. Very interesting Oh ~

After applying for Azure, after a long and patient wait, you receive a call to do not delete! Invitation Code to Microsoft. NET Services and Microsoft SQL Services.

It's finally started! Copy Invitation Code from mail, open http://portal.ex.azure.microsoft.com/, activate your SDS

The picture is not clear? Please click here to view the original image (larger).

When activated, click Get started in the upper right corner

Enter the SDS and create a new solution. Note: A invitation code can only create a solution.

Then came the management interface for. NET Services and SQL services

 

Click on the top solution Credentials to modify the solution password. Change into a good remember:

 

Well, now that you have the solution name and password you remember.

Download the SDS SDK http://www.microsoft.com/downloads/details.aspx?FamilyId=0B1FA5C6-EC9D-440B-939E-481DD05F2627&displaylang=en

Install the SDK.

Open the SSDs Explorer under the installation directory

 

Here we go over the last one about the ACE model.

 

Our order of operation is also based on this model.

First, create a authority, then create a different container under it, and then create multiple entity of the same type or different type under container.

As in the previous example, we can create a authority called "food" that includes two container named "Fruit" and "vegetable". container["Fruit" includes 3 entities, namely "Apple1", "Apple2", "pear1". Note, here we assume that the pentagram represents pear and the triangle represents Apple. In this way, the container["fruit" includes two types of three entity. Similarly, in the container["vegetable"], we assume that the circle is cabbage cabbage, square is the tomato tomato, we have "tomato1", "Tomato2", "Cabbage1" three entity, They are also of two different types.

And then we're reviewing the basic operation and the HTTP Verb mapping table

HTTP Verbsds operationgetfetch,query query postcreate new putupdate modify Deletedelete Delete

All right, that's enough. Enter ssDE explorer!!

The picture is not clear? Please click here to view the original image (larger).

The first step, of course, is to create authority. Directly click on the right button

This will appear in the text box

In <s:Id> and </s:Id> in the middle of the input authority name, I this is called food. Click when you are finished (because according to the mapping table above, the "new" operation corresponds to the HTTP verb "POST")

The Credentials dialog box may pop up and enter the solution name and password you just set.

If the operation succeeds, the bottom status box appears. If this is the case, the operation is incorrect, please change it according to the error prompt.

When the operation succeeds, the top address bar becomes

By the way, this is the URI of this authority. In the previous article, all the operations on this authority are actually HTTP operations on this URI.

Now we're going to build two container called "fruit" and "vegetable."

Click, enter "Fruit" in <s:Id> and </s:Id>, the text box is shown below

Click, the status bar becomes.

The URI shown in the address bar is https://food.data.database.windows.net/v1/fruit, and this is the URI of the container "fruit".

Now it's time to add concrete entity to the fruit. (vegetable similar, slightly).

We assume that there are two kinds of entity in the fruit,

One is Apple, including the following properties:

Property name Weightcoloravailabilityrecorddate type Decimalstringbooleandatetime

The other is pear, which includes the following properties

Property name Weightispopularproducingarea type decimalbooleanstring

Now let's add the first Apple: "Apple1"

Since we are inserting entity in the fruit this container, please keep the URI as Https://food.data.database.windows.net/v1/fruit

Click on the right side

Change the name of the default <entity/> label to <apple/>

Enter "Apple1" in the <s:Id/> label pair

Click on the property area on the right to add the property in turn. The property name is the node label name, please note the change.

There is an attribute called "Xsi:type" in the node that describes the property, representing the type of the current node.

such as <weight xsi:type= "X:decimal" >1.2</weight, defines a string property called Weight, whose value is 1.2.

The final appearance of the Apple1 is as follows:

The same way we can add apple2

 

Add Pear type Pear1

 

Oh, this is added. What if I want to revise apple1 at this time? Only need to enter HTTPS://FOOD.DATA.DATABASE.WINDOWS.NET/V1/FRUIT/APPLE1 in the Address bar, click, Modify and then click. (put corresponding update operation) Delete? Oh, a big one at the bottom, I don't have to say?

Then we can use LINQ to play with it!

The basic syntax is as follows

From E to datastore [where condition] order by [property] Select E

Operators and Boolean operators

 

For example, we can now enter https://food.data.database.windows.net/v1/in the address bar

In the Query box, enter from E in datastore where e.id== "fruit" Select E, click

The contents of fruit this container appear in the text box. Easy, huh?

Let's step up:

Address bar Input Https://food.data.database.windows.net/v1/fruit

Query box input from e-in datastore where e.kind== "Apple" Select E, click, the text box will show the contents of Apple1 and Apple2.

Again.

Execute query from E in datastore where e.kind== "Apple" && e["Color"]== "Red" Select E

You can only see the contents of the Apple2, because only the Apple2 "Color" equals "Red"

The reader may have doubts about coming here. Why E. Kind and e["Color"? The "." or "[]"? To explain, for entity metadata attributes (metadata property), you need to use ".", such as E. Id,e.kind for normal properties, use [], such as e["Color"

Readers can continue to practise more:

From e-in datastore where e.kind== "Apple" && (e["Color"]!= "Red" | | e["Color"]!= "Blue" Select E (using parentheses)

From E in datastore where e.kind== "Apple" && (e["Weight"]>=4) Select E (use expression)

From E in datastore where (e["Weight"]>=4) Select E (multiple kind entity can be mixed together for query)

From E in datastore where e["Recorddate"]>= "2008-12-15" Select E (usage date)

From E in Datastore select E (Get all entity)

From E in datastore where e.id> "Pea" Select E (string uses comparison symbols)

Note: The same kind entity can contain different properties (not recommended). For example, we can remove the <availability/> attribute from the apple1, without any effect at all. You can perform the following query to test

From E in datastore where e["availability"]==false && e.kind== "Apple" Select E

What do you think? It's simple and interesting, isn't it?

"Unarmed" and SDS "hand-to-hand combat" ends here. In the next article, we will use the C # language, all of the above operations to achieve programming, stay tuned.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.