BlackHole.Core.ORM
0.9.1
Old versions that were using dapper as mapper.
See the version list below for details.
dotnet add package BlackHole.Core.ORM --version 0.9.1
NuGet\Install-Package BlackHole.Core.ORM -Version 0.9.1
<PackageReference Include="BlackHole.Core.ORM" Version="0.9.1" />
paket add BlackHole.Core.ORM --version 0.9.1
#r "nuget: BlackHole.Core.ORM, 0.9.1"
// Install BlackHole.Core.ORM as a Cake Addin
#addin nuget:?package=BlackHole.Core.ORM&version=0.9.1
// Install BlackHole.Core.ORM as a Cake Tool
#tool nuget:?package=BlackHole.Core.ORM&version=0.9.1
BlackHole-Core-ORM
A fully automated, very easy to use and setup, with many new features, Object Relational Mapping Library, for .Net Core 6. Using Dapper in the Data Provider utilizing its full potential.
- 0.9.1 is released.
changes ⇒
Transactions were Added with 'using( var transaction = new BHTransaction)' every BHDataProvider action has an overload that accepts a BHTransaction object.
Unified Entities and DataProviders to One Generic BHDataProvider<T,G> that accepts Generic BlackHoleEntity<G>. And it now supports Integer , Guid and String Id columns which are autogenerated on Insert.
An Example Project is coming soon with the Documentation here ⇒ BlackHole Example
I am still working on the documentation but here are some quick steps to use this ORM
In Your project install Black.Hole.ORM from nuget
In your Program.cs add 'using BlackHole.FunctionalObjects' and 'using BlackHole.Enums'
Create some Entities in any folder that Inherit from the class 'BlackHoleEntity<int>' for Entities that are using Integer as Id, or 'BlackHoleEntity<Guid>' for Entities that are using Guid as Id or 'BlackHoleEntity<string>' for Entities that are using SHA1 hash as Id. (using BlackHole.Entities)
Add properties on your Entities except the Id property that already exists in the BlackHoleEntity class.
Add in your entities 'using BlackHole.Attributes.ColumnAttributes' to be able to use '[ForeignKey(typeof(Entity))]' , '[NotNullable]' and '[VarCharSize(int)]' attributes on your Entity's properties
- You can also use 'UseActivator' attribute on your Entity, to take advantage of the 'IsActive' column in case you need to keep the data after delete.
Make your services Inherit from 'BlackHoleScoped' or 'BlackHoleSingleton' or 'BlackHoleTransient' so they will be automatically registered on the Startup without needing services.Add(<>). (using BlackHole.Entities)
On your IServiceCollection 'services' add services.SuperNova(new BlackHoleBaseConfig{ string ConnectionString, enum BHSqlTypes.SqlType, string LogsPath }); The database name in the connection string is your choice. Just make sure that the server of the sql exists *if you don't have any Postgres or MySql or Microsoft Sql Server setup, you can use SqLite with a more simple command ⇒ services.SuperNovaLite(string databaseName);
Last step , go to your services or your controllers and add the Interfaces for the DataProviders ⇒ private readonly BHDataProvider<Entity,IdType> _entityService; ⇒ Example BHDataProvider<Customer,Guid> _customerService;
Done! You are ready to use all the functionality of the Data Providers in your services.
- there are descriptions on the methods of what they do
*The Ids are created automatically on Insert and they get returned.
- The cascade on Foreign keys is automatic and it depends on the Nullability of the column
I will soon upload here a more detailed guide of all the functionalities of this ORM, such as Stored Views and Joins and automatic mapping on DTOs or Updating Specific Columns.
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. |
-
net6.0
- Dapper (>= 2.0.123)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 6.0.4)
- Microsoft.Data.SqlClient (>= 5.0.1)
- Microsoft.Data.Sqlite.Core (>= 6.0.4)
- MySql.Data (>= 8.0.29)
- Npgsql (>= 6.0.4)
- SQLitePCLRaw.bundle_e_sqlite3 (>= 2.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added Transactions
-Unified Entities and Providers in One (ReadMe)
-fixed a MySql bug on casting a type to the same type in Joins