本文整理汇总了C#中IO.GetNodeListByDelegate方法的典型用法代码示例。如果您正苦于以下问题:C# IO.GetNodeListByDelegate方法的具体用法?C# IO.GetNodeListByDelegate怎么用?C# IO.GetNodeListByDelegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IO
的用法示例。
在下文中一共展示了IO.GetNodeListByDelegate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitModelSetting
/// <summary>
/// 初始化对象配置
/// </summary>
/// <param name="xmlwr"></param>
private void InitModelSetting(IO.XmlHelper xmlwr)
{
var modelnodes = xmlwr.GetNodeListByDelegate(delegate(XmlNode xn)
{
return xn.Name.Equals(ModelSettingNodeName, StringComparison.CurrentCultureIgnoreCase) &&
xn.ParentNode != null && xn.ParentNode.Name.Equals(ModelSettingParentNodeName, StringComparison.CurrentCultureIgnoreCase);
});
if (modelnodes != null)
{
ModelSettings = new List<ModelSetting>();
foreach (var xn in modelnodes)
{
var model = new ModelSetting();
model.Contract = IO.XmlHelper.ReadAttributeValue(xn, "contract");//读取类型
model.TableName = IO.XmlHelper.ReadAttributeValue(xn, "TableName/value");//表名
model.PrimaryKey = IO.XmlHelper.ReadAttributeValue(xn, "PrimaryKey/value");//表的主健
//model.Fields = IO.XmlWR.ReadAttributeValue(xn, "Model/Fields/value");//字段
model.Mapping = IO.XmlHelper.ReadAttributeValue(xn, "Mapping/value");//获取映射
foreach (XmlNode cn in xn.ChildNodes)
{
if (cn.Name.Equals(SelectNodeName, StringComparison.OrdinalIgnoreCase))//查询字段
{
model.Selects = GetCommandFromNode(cn);
}
else if (cn.Name.Equals(InsertNodeName, StringComparison.OrdinalIgnoreCase))//新增需要插入的字段
{
model.InsertCommands = GetCommandFromNode(cn);
}
else if (cn.Name.Equals(UpdateNodeName, StringComparison.OrdinalIgnoreCase))//修改需要插入的字段
{
model.UpdateCommands = GetCommandFromNode(cn);
}
}
ModelSettings.Add(model);
}
}
}
示例2: InitConnectionSetting
/// <summary>
/// 初始化连接字符串
/// </summary>
/// <param name="xmlwr"></param>
private void InitConnectionSetting(IO.XmlHelper xmlwr)
{
var connodes = xmlwr.GetNodeListByDelegate(delegate(XmlNode xn)
{
return xn.Name.Equals(ConSettingNodeName, StringComparison.CurrentCultureIgnoreCase) &&
xn.ParentNode != null && xn.ParentNode.Name.Equals(ConSettingParentNodeName, StringComparison.CurrentCultureIgnoreCase);
});
if (connodes != null)
{
ConSettings = new List<ConnSetting>();
foreach (var xn in connodes)
{
var con = new ConnSetting()
{
ConnectionString = IO.XmlHelper.ReadAttributeValue(xn, "connectionString"),//读取连接字符串
Name = IO.XmlHelper.ReadAttributeValue(xn, "name"),//读取配置名
ProviderName = IO.XmlHelper.ReadAttributeValue(xn, "providerName")//读取驱动
};
ConSettings.Add(con);
}
}
}