-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
starting to obsolete properties and go for methods #594
Conversation
@tobitege : can you review this pr? Code seems to be working, all tests are green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit skeptical about the purpose of these changes, do these fix a problem?
Adding extra "Get" methods for all descriptor List elements just adds interface bloat and functionally causes unnecessary code changes - imho with little to no advantages.
It should suffice to have them as "private set".
@@ -225,26 +225,19 @@ public override InvoiceDescriptor Load(Stream stream) | |||
XmlNodeList creditorFinancialAccountNodes = doc.SelectNodes("//ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:PayeePartyCreditorFinancialAccount", nsmgr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The processing of SpecifiedTradeSettlementPaymentMeans
is not correct, imo.
Each means
(card, bank account) is its own node within the NodeList of SpecifiedTradeSettlementPaymentMeans
and elements within it are not lists.
Thus below "for" loops and the use of "numberOfAccounts" is obsolete (InvoiceDescriptor20Reader.cs probably the same issue).
From ZF 2.3.2:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's address this separately
I understand this. Currently, items are added to these lists using Add() methods but items are retrieved accessing the pure properties. That is unbalanced and I'd like to correct this. |
As the new E.g. I could write both of GetCreditorFinancialAccounts().Add(new Bank Account() { ... });
AddCreditorFinancialAccount( ... );
// or
GetCreditorFinancialAccounts().Any();
AnyCreditorFinancialAccount(); Wouldn't these currently be equivalent? Does it have a benefit to provide both of them then? One advantage could be that e.g. I'm not experienced with ZUGFeRD-chsarp, but could it make sense to keep the From a consumer's perspective, is it really easier to write AddCreditorFinancialAccount("DE07123412341234123412", "XXXXDE11XXX"); then CreditorBankAccounts.Add(new() { IBAN = "DE07123412341234123412", BIC = "XXXXDE11XXX" }); I think the latter provides a lot of implicit familarities. I know what's going on in an instant. The former might do more stuff under the hood, but I can't know if it does. Imo, developers are quite used to working with What do you think? |
One option might be to differentiate cases where public List<TradeLineItem> TradeLineItems { get; internal set; } = new List<TradeLineItem>(); could be public IReadOnlyList<TradeLineItem> TradeLineItems => theBackingField.AsReadOnly(); while public List<BankAccount> CreditorBankAccounts { get; internal set; } could stay a list property with |
#372