本文整理汇总了C#中DataStrategy.UpdateMany方法的典型用法代码示例。如果您正苦于以下问题:C# DataStrategy.UpdateMany方法的具体用法?C# DataStrategy.UpdateMany怎么用?C# DataStrategy.UpdateMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStrategy
的用法示例。
在下文中一共展示了DataStrategy.UpdateMany方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateUsingKeys
private static object UpdateUsingKeys(DataStrategy dataStrategy, DynamicTable table, object[] args)
{
var record = ObjectToDictionary(args[0]);
var list = record as IList<IDictionary<string, object>>;
if (list != null) return dataStrategy.UpdateMany(table.GetQualifiedName(), list);
var dict = record as IDictionary<string, object>;
return dataStrategy.Update(table.GetQualifiedName(), dict);
}
示例2: Execute
public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
{
if (args.Length != 1) throw new ArgumentException("Incorrect number of arguments to Update method.");
var record = ObjectToDictionary(args[0]);
var list = record as IList<IDictionary<string, object>>;
if (list != null) return dataStrategy.UpdateMany(table.GetQualifiedName(), list);
var dict = record as IDictionary<string, object>;
return dataStrategy.Update(table.GetQualifiedName(), dict);
}
示例3: UpdateByKeyFields
internal static object UpdateByKeyFields(string tableName, DataStrategy dataStrategy, object entity, IEnumerable<string> keyFieldNames)
{
var record = ObjectToDictionary(entity);
var list = record as IList<IDictionary<string, object>>;
if (list != null) return dataStrategy.UpdateMany(tableName, list, keyFieldNames.ToList());
var dict = record as IDictionary<string, object>;
var criteria = GetCriteria(keyFieldNames, dict);
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(tableName, criteria);
return dataStrategy.Update(tableName, dict, criteriaExpression);
}
示例4: UpdateUsingOriginalValues
private static object UpdateUsingOriginalValues(DataStrategy dataStrategy, DynamicTable table, object[] args)
{
var newValues = ObjectToDictionary(args[0]);
var newValuesList = newValues as IList<IDictionary<string, object>>;
if (newValuesList != null)
{
var originalValuesList = ObjectToDictionary(args[1]) as IList<IDictionary<string, object>>;
if (originalValuesList == null) throw new InvalidOperationException("Parameter type mismatch; both parameters to Update should be same type.");
return dataStrategy.UpdateMany(table.GetQualifiedName(), newValuesList, originalValuesList);
}
var newValuesDict = newValues as IDictionary<string, object>;
var originalValuesDict = ObjectToDictionary(args[1]) as IDictionary<string, object>;
if (originalValuesDict == null) throw new InvalidOperationException("Parameter type mismatch; both parameters to Update should be same type.");
return dataStrategy.Update(table.GetQualifiedName(), newValuesDict, originalValuesDict);
}