DbToJson 1.1.0
Totally revisioned DbToJson utility
See the version list below for details.
dotnet add package DbToJson --version 1.1.0
NuGet\Install-Package DbToJson -Version 1.1.0
<PackageReference Include="DbToJson" Version="1.1.0" />
paket add DbToJson --version 1.1.0
#r "nuget: DbToJson, 1.1.0"
// Install DbToJson as a Cake Addin #addin nuget:?package=DbToJson&version=1.1.0 // Install DbToJson as a Cake Tool #tool nuget:?package=DbToJson&version=1.1.0
Getting Started
Once installed, DbToJson needs just few steps to work.
- Make sure DLL exist in references
- Add section
DbToJson
to the project's configuration file, like below:
<configuration>
<configSections>
<section name="DbToJson" type="System.Configuration.AppSettingsSection"/>
</configSections>
<connectionStrings>
<add name="Test" connectionString="..." providerName="System.Data.SqlClient" />
</connectionStrings>
<DbToJson>
<add key="ConnectionString" value="Test" />
</DbToJson>
</configuration>
Query
It builds up the interaction with database and return the expected result. The constructor awaits these two parameters:
Text
, equals to the stored procedure's name or SQL text of the queryService
, that is the response's translation service to useisSp
, by default to true, can be overrided when you want to execute SQL text
Query query = new Query("GetUsers", new JsonService());
Core
It is the singleton class that communicate with database. Expose the following methods:
GetObject
GetObjectList
GetPrimitive
Exec
N.B.: When you want an output in JSON format, use the type dynamic instead of string.
IService
Interface reusable to develop your own response's translation service to use with DbToJson. It expose the following methods:
TranslateObject
, when you have only one result in responseTranslateObjectList
, to translate lists of resultsTranslateObjectCommand
, needed when expected return paramaters from the stored procedure
Actually, DbToJson has included following services:
JsonService
, to convert in JSON formatObjectService
, to convert data in a specific type
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Newtonsoft.Json (>= 12.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added support for primitive types