本文整理汇总了C#中System.Data.DataSet.Merge方法的典型用法代码示例。如果您正苦于以下问题:C# System.Data.DataSet.Merge方法的具体用法?C# System.Data.DataSet.Merge怎么用?C# System.Data.DataSet.Merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataSet
的用法示例。
在下文中一共展示了System.Data.DataSet.Merge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
internal static void Process (List<string> assemblies, string outputPath)
{
List<string> valid_config_files = new List<string> ();
foreach (string assembly in assemblies) {
string assemblyConfig = assembly + ".config";
if (File.Exists (assemblyConfig)) {
XmlDocument doc = new XmlDocument ();
try {
doc.Load (assemblyConfig);
} catch (XmlException) {
doc = null;
}
if (doc != null)
valid_config_files.Add (assemblyConfig);
}
}
if (valid_config_files.Count == 0)
return;
string first_file = valid_config_files [0];
System.Data.DataSet dataset = new System.Data.DataSet ();
dataset.ReadXml (first_file);
valid_config_files.Remove (first_file);
foreach (string config_file in valid_config_files) {
System.Data.DataSet next_dataset = new System.Data.DataSet ();
next_dataset.ReadXml (config_file);
dataset.Merge (next_dataset);
}
dataset.WriteXml (outputPath + ".config");
}
示例2: Process
internal static void Process(ILRepack repack)
{
try
{
var validConfigFiles = new List<string>();
foreach (string assembly in repack.MergedAssemblyFiles)
{
string assemblyConfig = assembly + ".config";
if (File.Exists(assemblyConfig))
{
var doc = new XmlDocument();
doc.Load(assemblyConfig);
validConfigFiles.Add(assemblyConfig);
}
}
if (validConfigFiles.Count == 0)
return;
string firstFile = validConfigFiles[0];
var dataset = new System.Data.DataSet();
dataset.ReadXml(firstFile);
validConfigFiles.Remove(firstFile);
foreach (string configFile in validConfigFiles)
{
var nextDataset = new System.Data.DataSet();
nextDataset.ReadXml(configFile);
dataset.Merge(nextDataset);
}
dataset.WriteXml(repack.OutputFile + ".config");
}
catch (Exception e)
{
repack.ERROR("Failed to merge configuration files: " + e);
}
}
示例3: GetAppendList
public System.Data.DataSet GetAppendList(Dictionary<Guid, Guid> multiBuffer)
{
int countProducts = multiBuffer.Where(item => Guid.Empty.Equals(item.Value)).Count();
int countProductsWithConfiguration = multiBuffer.Where(item => !Guid.Empty.Equals(item.Value)).Count(); ;
System.Data.DataSet dataSet = new System.Data.DataSet();
using (CommonDataProvider provider = new CommonDataProvider())
{
/*
* Надо обязательно исправить, в случае когда в буфере будут и конфигурации
* и просто продукты -- получится не хорошо...
*/
if (countProducts > 0)
{
string sqlProducts = BuildAppendProductsQuery(multiBuffer);
dataSet.Merge(provider.ExecuteCommand(sqlProducts));
}
if (countProductsWithConfiguration > 0)
{
string sqlConfigurations = BuildAppendConfigurationsQuery(multiBuffer);
dataSet.Merge(provider.ExecuteCommand(sqlConfigurations));
}
}
return dataSet;
}