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

BHoM_Adapter - refactoring - Level 3 changes #151

Merged
merged 32 commits into from
Nov 1, 2019

Conversation

alelom
Copy link
Member

@alelom alelom commented Oct 18, 2019

Issues addressed by this PR

Closes #114 ,Closes #87, closes #147, closes #155, closes #113, closes #109, closes #148, closes #149

NOTE: This PR will break ALL TOOLKITS that include an Adapter project

However, no script will break due to this.

There is an admin issue that explains the steps needed to align with this change.

Changelog

  • Adapter Actions:

    • All Adapter actions (Push, Pull, etc) now live in different files (Push.cs, Pull.cs, etc) in a folder named AdapterActions.
      • The Delete Adapter Action now lives in a file (temporarily?) named Remove.cs, while awaiting on the decision on a better naming to distinguish it from the CRUD delete. Discussion here.
    • Removed the UpdateProperty Adapter Action, as discussed here.
    • Added a dispatch pattern in the Pull() that calls the appropriate Read()/ReadResults() method depending on the base parent type of the provided request, using as dynamic.
  • CRUD methods:

    • Removed the parameter replaceAll from the Create() method signature. It was never properly used.
    • Changes in the Read/ReadResults methods:
      • Added empty protected virtual Read(IRequest) Wrapper virtual method
      • Added empty protected virtual ReadResult(IRequest) Wrapper virtual method
      • These Read methods will now be required in single Toolkit implementations in order for the Read to work with different types of Requests. The appropriate read method will now be called by the as dynamic pattern in the Pull, as introduced above in the "Adapter Actions" changes.
    • Made all CRUD Wrapper Methods virtual for consistency.
    • Tidy up in the arrangement of the CRUD methods:
      • Moved the "Protected Abstract CRUD Methods" in their respective files in the CRUD folder (Create.cs, Read.cs, etc.). From now on, we will call those Basic CRUD methods.
      • Renamed the UpdateOnly.cs file to Update.cs.
      • Moved the UpdateProperty in the same file as the UpdateOnly, Update.cs.
      • Added comment sections to clearly separate Basic CRUD methods and Wrapper CRUD methods. Wrapper methods are now those that are meant to add some functionality and then call the Basic CRUD method.
      • Added comments to clarify when such or such method should be implemented/overridden
  • Adapter properties:

    • Deleted the superseded ErrorLog Adapter property.
    • Changes to the Adapter Config public property:
      • Renamed SeparateProperties to HandleDependencies. Changed its default value from False to True.
      • Changed the default value of ProcessInMemory from True to False.
      • Removed MergeWithComparer property. It was never used.
  • Adapter other methods:

    • Renamed Replace() method to CRUD()
  • File_Adapter:

    • File_Adapter: changes to comply with the changes above.
    • File_Adapter: removed the Legacy folder and its content (was all commented/unused code).

Additional notes

Needs all these PRs to be merged in master:

@alelom alelom self-assigned this Oct 18, 2019
@alelom alelom added the status:WIP PR in progress and still in draft, not ready for formal review label Oct 18, 2019
@alelom alelom added this to the BHoM 3.0 β MVP milestone Oct 18, 2019
1. Removed `MergeWithComparer` which was never used. It was only referenced in `ReplaceInMemory()` but that case was never true due to Toolkit implementations. Added a bool `mergeWithCompararer` input parameter in the `ReplaceInMemory()` method instead.
2. Changed `ProcessInMemory` default value to `false`.
3. Changed `HandleDependencies` (formerly `SeparateProperties`) default value to `true`.
@alelom alelom removed the status:WIP PR in progress and still in draft, not ready for formal review label Oct 29, 2019
@alelom alelom marked this pull request as ready for review October 29, 2019 14:05
Copy link
Contributor

@FraserGreenroyd FraserGreenroyd left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment