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

Action with nullable parameter #215

Open
bpaolo71 opened this issue Dec 1, 2021 · 1 comment
Open

Action with nullable parameter #215

bpaolo71 opened this issue Dec 1, 2021 · 1 comment

Comments

@bpaolo71
Copy link

bpaolo71 commented Dec 1, 2021

I'm a bit confused about why action has a nullable parameter.
I was trying to use SupplierInvoiceConnector.Cancel that has long? as parameter.
But if I use null as parameter i get back 'Request failed: Värdet måste vara numeriskt (cancel)' so i suppose that the parameter should be a long istead ! Or I am wrong ?

@richardrandak
Copy link
Collaborator

The reason is the same as why Get methods have null-able parameter.
Honestly, I think I made it nullable just to match the type with the primary ID of the entity, which is nullable for other reason.

If it was "long", you would have to always add .Value when used.
e.g. connector.Cancel(invoice.GivenNumber.Value);

Is there any downside of this, apart from that a user may try "null" and realize it won't work? :)
Maybe it make sense to think of converting all primary ids to not-null, even in entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants