BlackHole.Core.Cli
1.0.1
dotnet tool install --global BlackHole.Core.Cli --version 1.0.1
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local BlackHole.Core.Cli --version 1.0.1
#tool dotnet:?package=BlackHole.Core.Cli&version=1.0.1
nuke :add-package BlackHole.Core.Cli --version 1.0.1
BlackHole-Core-Cli
A dotnet tool that is the Command Line Interface for BlackHole-Core-ORM. Find BlackHole-Core-ORM on Nuget
You can install this as a dotnet global tool and then run it from the command line of your solution folder, or from the package manager console in visual studio. You need to have the BlackHole Core ORM included in your project in order for this cli to work.
To run this Cli you need to type 'bhl' and then the command that you wish.
It supports 3 basic commands and 2 arguments on each one of them:
First Command:
update ⇒ Example: 'bhl update'
Update command reads the 'BlackHoleEntities' in your project and the connection string and it generates or updates the database based on these.
Important: Create the Entities and configure BlackHole before running this command.
If you accidently delete a property from your 'BlackHoleEntities' the cli will not delete the column in the database. It will set it to Nullable. If you wish to delete unused columns from the database, then delete the corresponding properties from the BlackHoleEntities and then run 'bhl update -f' or 'bhl update --force' to force a strict update on the database. If BlackHole is in developer mode then the --force argument is used by default from the Cli.
Also in case you need to keep a history of the database updates, BlackHole Cli can store the changes in Sql files to the selected default Datapath, by using the argument '-s' or '--save' after the command. Example : 'bhl update -s'
You can use both '--force' and '--save' arguments in the same command. Example 'bhl update -f -s'
Second Command:
drop ⇒ Example: 'bhl drop'
Drop command reads the connection string from the BlackHole's settings and ONLY if BlackHole is in developer mode, it drops the database.
If you are not using developer mode in BlackHole Settings but you still want to drop the database, you need to use the '-f' or '--force' argument after the command. Example: 'bhl drop -f'
If you also want to delete the existing Sql files that were written in a previous 'bhl update -s' command, you can use again the '-s' or '--save' argument with the drop command, to delete them. Example: 'bhl drop -s'
You can use both '--force' and '--save' arguments in the same command. Example 'bhl drop -f -s'
Third Command:
parse ⇒ Example: 'bhl parse'
Parse command reads the connection string from the BlackHole's settings and searches for an existing database in that location. If the database can be found then the Cli will read the tables, the columns and the constraints of that database and it will create a namespace in your project with the name 'BHEntities' where it will generate all the corresponding BlackHoleEntities based on the existing database.
This command gives the 'Database First' ability to the BlackHole Core ORM.
If the database is compatible with BlackHole's restrictions it will parse it directly without any errors.
If there are incompatibilities then the Cli will stop the process and will generate a Parse report at the selected default Datapath folder, that will describe all the changes that are required to the database, in order to parse it. There are 3 levels of incompatibilities, 'Minor', 'Medium', 'Serious'. You can overcome the first two levels easily.
If you want to parse the database even if it is incompatible, you can use the '--force' or '-f' argument after the parse command. With this argument, the Cli will parse all the Entities that have 'Minor' or 'Medium' level incompatibilities and it will also, generate a report of the parsing.
VERY IMPORTANT!!! ⇒ BlackHole updates the database automatically on the Startup of the application, if your database is incompatible DO NOT start your application after parsing with the '--force' argument. Mikarsoft and BlackHole Core ORM have no responsibility for any dataloss or damage in your database
BlackHole Example:
-Find an Example Project here ⇒ BlackHole Example
BlackHole Documentation:
-Find Online Documentation here ⇒ BlackHole Documentation
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 210 | 6/28/2023 |
- Install this app as a dotnet tool.
- Type 'bhl' to call it in console, followed by one of the following commands
- bhl update => Updates the database based on the BlackHole Entities in your project
- bhl drop => drops the database only if you have set BlackHole in developer mode
- bhl parse => parsing an existing database and generates the required BlackHole Entities in your project
Arguments:
- force => '-f' or '--force' Forces a job to be done even if BlackHole is not in developer mode. Example: bhl drop -f
- save => '-s' or '--save' Saves the sql commands that it used in the process. Example: bhl update -s