Пример #1
0
        public async Task <int> UpdateItemAsync(string prefixItem, string primaryKeys, Dictionary <string, JsonElement> data)
        {
            var ep    = Configuration.Endpoints.GetValueOrDefault(prefixItem);
            var param = ParseSchemaFields(ep.UpdateFields, data);

            // Merge with primary keys paramas
            foreach (var p in GetParsePrimaryKeys(ep.PrimaryKeys, primaryKeys))
            {
                param[p.Key] = p.Value;
            }

            var sqlOrMethod = string.Join("\n", ep.UpdateItem);

            return(await db.RunAsync(conn =>
            {
                return conn.ExecuteAsync(sqlOrMethod, param);
            }));
        }