2006-12-15

sql2005的xml字段类型在.net中的应用

来源: 本站收集整理 作者:佚名 评论 0 条
 
/// 服务器群信息集合
/// </summary>
public MServerGroupCollection()
{
this._MServerGroups = new List<MServerGroup>();
}

private List<MServerGroup> _MServerGroups;

public List<MServerGroup> MServerGroups
{
get
{
return this._MServerGroups;
}
set
{
this._MServerGroups = value;
}
}
}

/// <summary>
/// 服务器群下的服务器信息集合
/// </summary>
[XmlRoot("Servers")]
[Serializable()]
public class MServerCollection : List<MServer>
{
/// <summary>
/// 服务器群下的服务器信息集合
/// </summary>
public MServerCollection()
{
this._MServers = new List<MServer>();
}

private List<MServer> _MServers;

public List<MServer> MServers
{
get
{
return this._MServers;
}
set
{
this._MServers = value;
}
}
}

/// <summary>
/// 服务器对应的店铺集合
/// </summary>
[Serializable()]
[XmlRoot(ElementName = "Shops", Namespace = "http://www.linkedu.com.cn/MServerShop.xsd")]
public class MServerShopCollection
{
private List<MServerShop> _MServerShops;

[XmlElement("Shop")]
public List<MServerShop> MServerShops
{
get
{
return this._MServerShops;
}
set
{
this._MServerShops = value;
}
}
/// <summary>
/// 服务器对应的店铺集合类
/// </summary>
public MServerShopCollection()
{
this._MServerShops = new List<MServerShop>();
}

}

经分析,服务器对应的店铺信息可用xml存储,设计格式如下(用xsd描述,设计好后,我们把它创建到数据库中)
CREATE XML SCHEMA COLLECTION [dbo].[MServerShop] AS
N'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:t="http://www.linkedu.com.cn/MServerShop.xsd" targetNamespace="http://www.linkedu.com.cn/MServerShop.xsd" elementFormDefault="qualified">
<xsd:element name="Shops">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="Shop" type="t:ServerShop" minOccurs="0" maxOccurs="unbounded" />
共12页: 上一页 [1] [2] [3] [4] 5 [6] [7] [8] [9] [10] [11] [12] 下一页

(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:SQL Server 2005与DB2 8.2对比分析  
下一篇:SQL Server2005发布元年 微软正身企业级应用
    评论加载中…
 推荐文章
     

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号