Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database: Fix/database query activities failing parameters conversion from DBNull (71685) #445

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ protected async override Task<Action<AsyncCodeActivityContext>> ExecuteInternalA
var currentParam = Parameters[param.Key];
if (currentParam.Direction == ArgumentDirection.Out || currentParam.Direction == ArgumentDirection.InOut)
{
currentParam.Set(asyncCodeActivityContext, param.Value.Value);
if (param.Value.Value != DBNull.Value)
{
currentParam.Set(asyncCodeActivityContext, param.Value.Value);
}
else
{
currentParam.Set(asyncCodeActivityContext, null);
Copy link
Collaborator

@viogroza viogroza Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the condition on else
if there is nothing to set, I would not set null; (this is a business requirement)
for example if I have a in/out param with the initial value 100, then the procedures value for the param is DbNull.. do we want to set to zero the value in this case? or let it as it was? we can use default instead of null if needed

also null assignment wouldn't work if the type is a value type (eg. integer or bool);
eg.:
object o = null;
bool v = (bool)o;

}
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,14 @@ protected async override Task<Action<AsyncCodeActivityContext>> ExecuteInternalA
var currentParam = Parameters[param.Key];
if (currentParam.Direction == ArgumentDirection.Out || currentParam.Direction == ArgumentDirection.InOut)
{
currentParam.Set(asyncCodeActivityContext, param.Value.Value);
if (param.Value.Value != DBNull.Value)
{
currentParam.Set(asyncCodeActivityContext, param.Value.Value);
}
else
{
currentParam.Set(asyncCodeActivityContext, null);
}
}
}
};
Expand Down