当前位置: 首页>>代码示例>>C#>>正文


C# DataStrategy.Update方法代码示例

本文整理汇总了C#中DataStrategy.Update方法的典型用法代码示例。如果您正苦于以下问题:C# DataStrategy.Update方法的具体用法?C# DataStrategy.Update怎么用?C# DataStrategy.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataStrategy的用法示例。


在下文中一共展示了DataStrategy.Update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateByKeyFields

 internal static object UpdateByKeyFields(string tableName, DataStrategy dataStrategy, object entity, IEnumerable<string> keyFieldNames)
 {
     var record = ObjectToDictionary(entity);
     var criteria = GetCriteria(keyFieldNames, record);
     var criteriaExpression = ExpressionHelper.CriteriaDictionaryToExpression(tableName, criteria);
     return dataStrategy.Update(tableName, record, criteriaExpression);
 }
开发者ID:ryansroberts,项目名称:Simple.Data,代码行数:7,代码来源:UpdateCommand.cs

示例2: 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);
        }
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:9,代码来源:UpdateCommand.cs

示例3: Execute

        public object Execute(DataStrategy dataStrategy, DynamicTable table, InvokeMemberBinder binder, object[] args)
        {
            var criteria = args.OfType<SimpleExpression>().SingleOrDefault() ?? new SimpleEmptyExpression();

            var data = binder.NamedArgumentsToDictionary(args).Where(kv=>!(kv.Value is SimpleExpression)).ToDictionary();

            var updatedCount = dataStrategy.Update(table.GetQualifiedName(), data, criteria);
            
            return updatedCount.ResultSetFromModifiedRowCount();
        }
开发者ID:vansha,项目名称:Simple.Data,代码行数:10,代码来源:UpdateAllCommand.cs

示例4: 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);
        }
开发者ID:paulecoyote,项目名称:Simple.Data,代码行数:11,代码来源:UpdateCommand.cs

示例5: 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);
        }
开发者ID:ciriarte,项目名称:Simple.Data,代码行数:11,代码来源:UpdateCommand.cs

示例6: 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);
        }
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:15,代码来源:UpdateByCommand.cs

示例7: 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);
        }
开发者ID:reverentgeek,项目名称:Simple.Data,代码行数:16,代码来源:UpdateCommand.cs


注:本文中的DataStrategy.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。