The Wayback Machine - https://web.archive.org/web/20201023121747/https://github.com/libplctag/libplctag.NET/pull/93
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

Overload Read/Write to actually use Value directly #93

Draft
wants to merge 3 commits into
base: master
from

Conversation

@jkoplo
Copy link
Member

@jkoplo jkoplo commented Sep 10, 2020

@timyhac - This is what I was talking about in chat. When testing in real-world I found myself with a lot of lines that looked like:

workOrderRequest.Value = workOrderDTO.Request;
workOrderRequest.Write();

workOrderQuantity.Value = workOrderDTO.Quantity;
workOrderQuantity.Write();

workOrderDate.Value = workOrderDTO.Date;
workOrderDate.Write();

It felt really redundant for something that is a pretty common need. The PLC side was written by an external supplier, so remapping into a UDT for a single write wasn't really an option.

The overloads should be a non-breaking API change (not that it matters at this point). You can stick with the old functionality above if you need to queue a bunch of writes, or utilize the overload to pass values as part of the Write:

workOrderRequest.Write(workOrderDTO.Request);
workOrderQuantity.Write(workOrderDTO.Quantity);
workOrderDate.Write(workOrderDTO.Date);

Thoughts? I don't really see a downside other than having more API calls and maybe being a little more confusing to people using the library since there's options?

@jkoplo jkoplo requested a review from timyhac Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.