本文整理匯總了C#中System.Dynamic.InvokeMemberBinder.HasSingleUnnamedArgument方法的典型用法代碼示例。如果您正苦於以下問題:C# InvokeMemberBinder.HasSingleUnnamedArgument方法的具體用法?C# InvokeMemberBinder.HasSingleUnnamedArgument怎麽用?C# InvokeMemberBinder.HasSingleUnnamedArgument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Dynamic.InvokeMemberBinder
的用法示例。
在下文中一共展示了InvokeMemberBinder.HasSingleUnnamedArgument方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DoInsert
private static IDictionary<string, object> DoInsert(InvokeMemberBinder binder, object[] args, Database database, string tableName)
{
return binder.HasSingleUnnamedArgument()
?
InsertEntity(args[0], database, tableName)
:
InsertDictionary(binder, args, database, tableName);
}
示例2: Execute
public object Execute(Database database, string tableName, InvokeMemberBinder binder, object[] args)
{
if (binder.HasSingleUnnamedArgument())
{
return UpdateCommand.UpdateByKeyFields(tableName, database, args[0],
MethodNameParser.ParseCriteriaNamesFromMethodName(binder.Name));
}
var criteria = MethodNameParser.ParseFromBinder(binder, args);
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(tableName, criteria);
var data = binder.NamedArgumentsToDictionary(args)
.Where(kvp => !criteria.ContainsKey(kvp.Key))
.ToDictionary();
return database.Adapter.Update(tableName, data, criteriaExpression);
}
示例3: Execute
public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
{
if (binder.HasSingleUnnamedArgument())
{
return UpdateByKeyFields(table.GetQualifiedName(), dataStrategy, args[0],
MethodNameParser.ParseCriteriaNamesFromMethodName(binder.Name));
}
var criteria = MethodNameParser.ParseFromBinder(binder, args);
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(), criteria);
var data = binder.NamedArgumentsToDictionary(args)
.Where(kvp => !criteria.ContainsKey(kvp.Key))
.ToDictionary();
return dataStrategy.Update(table.GetQualifiedName(), data, criteriaExpression);
}
示例4: DoInsert
private static object DoInsert(InvokeMemberBinder binder, object[] args, DataStrategy dataStrategy, string tableName)
{
if (binder.HasSingleUnnamedArgument())
{
return InsertEntity(args[0], dataStrategy, tableName, (r,e) => false, !binder.IsResultDiscarded());
}
if (args.Length == 2)
{
var onError = args[1] as ErrorCallback;
if (onError != null)
{
return InsertEntity(args[0], dataStrategy, tableName, onError, !binder.IsResultDiscarded());
}
}
return InsertDictionary(binder, args, dataStrategy, tableName);
}
示例5: Execute
public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
{
object result;
if (binder.HasSingleUnnamedArgument() || args.Length == 2 && args[1] is ErrorCallback)
{
result = UpsertByKeyFields(table.GetQualifiedName(), dataStrategy, args[0],
MethodNameParser.ParseCriteriaNamesFromMethodName(binder.Name),
!binder.IsResultDiscarded(),
args.Length == 2 ? (ErrorCallback)args[1] : ((item, exception) => false));
}
else
{
var criteria = MethodNameParser.ParseFromBinder(binder, args);
var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(table.GetQualifiedName(),
criteria);
var data = binder.NamedArgumentsToDictionary(args);
result = dataStrategy.Upsert(table.GetQualifiedName(), data, criteriaExpression, !binder.IsResultDiscarded());
}
return ResultHelper.TypeResult(result, table, dataStrategy);
}