-
Notifications
You must be signed in to change notification settings - Fork 16
The CRUD methods
The CRUD methods are the actual methods have to be implemented in the specific Toolkits. Their scope has to be kept strictly to a minimum, as explained below.
Create must take care only of Creating, or exporting, the objects. Anything else is out of its scope.
For example, a logic that takes care of checking whether some object already exists in the External model – and, based on that, decides whether to export or not – cannot sit in the Create method, but has rather to be included in the Push. This very case (checking existing object) is already covered by the Push logic.
The main point is: keep the Create simple. It will be called when appropriate by the Push.
The Create method scope should in general be limited to this:
- calling some conversion from BHoM to the object model of the specific software and a
- Use the external software API to export the objects.
If no API calls are necessary to convert the objects, the best practice is to do this conversion in a ToSoftwareName
file that extends the public static class Convert
. See the GSA_Toolkit for an example of this.
If API calls are required for the conversion, it's best to include the conversion process directly in the Create method. See Robot_Toolkit for an example of this.
In the Toolkit template, you will find some methods to get you started for creating BH.oM.Structure.Element.Bar
objects.
This is a method for returning a free index that can be used in the creation process.
Important method to implement to get pushing of dependant properties working correctly. Some more info given in the Toolkit template.
The read method is responsible for reading the external model and returning all objects that respect some rule (or, simply, all of them).
There are many available overloads for the Read. You should assume that any of them can be called "when appropriate" by the Push and Pull adapter actions.
The Read method scope should in general be specular to the Create:
- Use the external software API to import the objects.
- Call some conversion from the object model of the specific software to the BHoM object model.
Like for the Create, if no API calls are necessary to convert the objects, the best practice is to do this conversion in a FromSoftwareName
file that extends the public static class Convert
. See the GSA_Toolkit for an example of this.
Otherwise, if API calls are required for the conversion, it's best to include the conversion process directly in the Read method. See Robot_Toolkit for an example of this.
The Update has to take care of copying properties from from a new version of an object (typically, the one currently being Pushed) to an old version of an object (typically, the one that has been Read from the external model).
The update will be called when appropriate by the Push.
WIP
The Update has to take care of deleting an object from an external model. The Delete is called by these Adapter Actions: the Remove and the Push. See the Adapter Actions page for more info.
By default, an object with multiple tags on it will not be deleted; it only will get that tag removed from itself.
This guaranties that elements created by other people/teams will not be damaged by your delete.
-
Introduction to the BHoM:
What is the BHoM for?
Structure of the BHoM
Technical Philosophy of the BHoM -
Getting Started:
Installing the BHoM
Using the BHoM
Submitting an Issue
Getting started for developers -
Use GitHub & Visual Studio:
Using the SCRUM Board
Resolving an Issue
Avoiding Conflicts
Creating a new Repository
Using Visual Studio
Using Visual Studio Code -
Contribute:
The oM
The Engine
The Adapter
The Toolkit
The UI
The Tests -
Guidelines:
Unit convention
Geometry
BHoM_Engine Classes
The IImmutable Interface
Handling Exceptional Events
BHoM Structural Conventions
BHoM View Quality Conventions
Code Versioning
Wiki Style
Coding Style
Null Handling
Code Attributes
Creating Icons
Changelog
Releases and Versioning
Open Sourcing Procedure
Dataset guidelines -
Foundational Interfaces:
IElement Required Extension Methods -
Continuous Integration:
Introduction
Check-PR-Builds
Check-Core
Check-Installer -
Code Compliance:
Compliance -
Further Reading:
FAQ
Structural Adapters
Mongo_Toolkit
Socket_Toolkit