【IT168 资讯】SDS其实是很友善、很好玩的。这一节我们不会使用任何的编程语言, 流牛木马将带领大家,仅靠SDK里的一个叫做SSDS Explorer小工具来玩转SDS,熟悉和实现上一篇讲述的一些内容。很有趣的哦
在申请Azure后,经过耐心漫长地等待,你会收到一封叫做“Do Not Delete! Invitation Code to Microsoft .NET Services and Microsoft SQL Services”的邮件。
终于开始了!从邮件中复制出Invitation Code,打开http://portal.ex.azure.microsoft.com/,激活你的SDS
下载SDS的SDK http://www.microsoft.com/downloads/details.aspx?FamilyId=0B1FA5C6-EC9D-440B-939E-481DD05F2627&displaylang=en
安装SDK.
打开安装目录下的SSDS Explorer
我们的操作顺序也是根据这一模型来的。
首先要建立一个Authority,然后在它下面建立不同的Container,最后再在Container下建立多个同类型或者不同类型的Entity。
还是上一篇的例子,与上图对照,我们可以创建一个叫做"food"的Authority,其下包括名为"fruit"和"vegetable"两个Container. Container["fruit"]中包括3个实体,分别是"apple1","apple2","pear1".注意,这里我们假设五角星代表pear,三角形代表apple。这样,在这个 Container["fruit"]就包括了两种类型的三个Entity。同样,在Container["vegetable"]中,我们假设圆形是白菜cabbage,方形是西红柿tomato,我们又有了"tomato1","tomato2" ,"cabbage1"三个entity,它们也属于两种不同类型。。
接着我们在复习一下基本操作与HTTP Verb的映射表 HTTP Verb SDS Operation
GET Fetch,Query 查询
POST Create 新建
PUT Update 修改
DELETE Delete 删除
好了,够了,开工!进入SSDE Explorer!!
读者可以继续练习更多:
from e in entities where e.Kind=="Apple" && (e["Color"]!="Red"||e["Color"]!="Blue") select e (使用括号)
from e in entities where e.Kind=="Apple" && (e["Weight"]>=4) select e (使用表达式)
from e in entities where (e["Weight"]>=4) select e(多种Kind的Entity可以混合在一起查询)
from e in entities where e["RecordDate"]>="2008-12-15" select e(使用日期)
from e in entities select e (取得所有Entity)
from e in entities where e.Id>"pea" select e (字符串使用比较符号)
注意: 同一个Kind的Entity可以包含的不同的属性(不推荐)。比如我们可以把apple1中的<Availability />属性删除掉,完全没有影响。可以执行以下查询进行测试
from e in entities where e["Availability"]==false && e.Kind=="Apple" select e
怎么样?很简单很有趣吧?
“赤手空拳”与SDS“肉搏"到此为止。在下一篇中,我们将使用C#语言,对以上所有的操作进行编程实现,敬请关注。