Fix EntityStorage parameter binding

features/nuget_autobuild
Matija Koželj 2 years ago
parent 339dc635e5
commit ccd824dcc3

@ -152,7 +152,11 @@ internal class EntityStorage<TEntity> : IAsyncEnumerable<TEntity>, IStorage<TEnt
await Execute(new StorageContextArgs(operation)); await Execute(new StorageContextArgs(operation));
return entity; var clone = entity.Clone();
ReturnValueBinder.Bind(operation, clone);
return clone;
} }
/// <summary> /// <summary>
/// Performs the update on the specified entity with optional concurrency callback support. /// Performs the update on the specified entity with optional concurrency callback support.
@ -274,7 +278,7 @@ internal class EntityStorage<TEntity> : IAsyncEnumerable<TEntity>, IStorage<TEnt
/* /*
* Bind storage parameters with operation parameters. * Bind storage parameters with operation parameters.
*/ */
ReturnValueBinder.Bind(writer, args.Operation); ReturnValueBinder.Bind(writer.Operation, args.Operation);
return recordsAffected; return recordsAffected;
} }

@ -8,14 +8,11 @@ namespace Connected.Data.Storage
{ {
internal static class ReturnValueBinder internal static class ReturnValueBinder
{ {
public static void Bind(IStorageWriter w, IStorageOperation operation) public static void Bind(IStorageOperation operation, object entity)
{ {
List<PropertyInfo> properties = null; List<PropertyInfo> properties = null;
if (w.Operation.Parameters is null) foreach (var parameter in operation.Parameters)
return;
foreach (var parameter in w.Operation.Parameters)
{ {
if (parameter.Direction != ParameterDirection.ReturnValue && parameter.Direction != ParameterDirection.Output) if (parameter.Direction != ParameterDirection.ReturnValue && parameter.Direction != ParameterDirection.Output)
continue; continue;

Loading…
Cancel
Save