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

Upgrade to .NET 8.0 and refactor input value extraction #681

Merged
merged 2 commits into from
Nov 2, 2024

Conversation

ramioh
Copy link
Contributor

@ramioh ramioh commented Oct 15, 2024

  • Upgrade from .NET 6.0 to .NET 8.0.
  • Use C# pattern matching to simplify code.
  • Create a separate folder, named SaveByTemplate, for the ExcelOpenXmlTemplate class and its three files.
  • Move input value extraction to a separate class named InputValueExtractor
  • Use interfaces to facilitate unit testing.
  • Use the third-party library FluentAssertions in tests to help with asserting results in less code.

Comment on lines +34 to +36
var fieldValues = type
.GetFields(BindingFlags.Public | BindingFlags.Instance)
.Select(field => new { field.Name, Value = field.GetValue(valueObject) });
Copy link
Contributor Author

@ramioh ramioh Oct 15, 2024

Choose a reason for hiding this comment

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

The old code had a check to exclude a field by name if it was previously added as a property. I removed this check because I can't think how this can ever be true. But please correct me if I am wrong.

var sheetStream = sheet.Open();
var fullName = sheet.FullName;

var inputValues = _inputValueExtractor.ToValueDictionary(value);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is where the new class is called: InputValueExtractor.ToValueDictionary()

Copy link
Member

Choose a reason for hiding this comment

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

.NET 6.0 (LTS) end date is Nov 12, 2024, we will follow the date to upgrade next month.

@shps951023
Copy link
Member

@ramioh 👍👍👍 If no other partner's feedback, PR will be merged Nov 12, 2024(.NET 6.0 (LTS) end date), and could we invite you to our team?

@shps951023 shps951023 merged commit a0797a5 into mini-software:master Nov 2, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants