Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thiagobarradas/sqlclient-parsetoobject
Easy SqlClient parse to object for .NET Core
https://github.com/thiagobarradas/sqlclient-parsetoobject
dapper dotnet-core dotnet-core-2 dotnet-core-3 mapping object objective-c parser sql sqlclient
Last synced: 10 days ago
JSON representation
Easy SqlClient parse to object for .NET Core
- Host: GitHub
- URL: https://github.com/thiagobarradas/sqlclient-parsetoobject
- Owner: ThiagoBarradas
- License: mit
- Created: 2020-03-31T20:38:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-10T00:25:00.000Z (over 4 years ago)
- Last Synced: 2025-01-07T05:53:01.638Z (16 days ago)
- Topics: dapper, dotnet-core, dotnet-core-2, dotnet-core-3, mapping, object, objective-c, parser, sql, sqlclient
- Language: C#
- Homepage: https://www.nuget.org/packages/SqlClient.ParseToObject
- Size: 20.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://barradas.visualstudio.com/Contributions/_apis/build/status/NugetPackage/SqlClient%20ParseToObject?branchName=develop)](https://barradas.visualstudio.com/Contributions/_build/latest?definitionId=20&branchName=develop)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ThiagoBarradas_sqlclient-parsetoobject&metric=alert_status)](https://sonarcloud.io/dashboard?id=ThiagoBarradas_sqlclient-parsetoobject)
[![NuGet Downloads](https://img.shields.io/nuget/dt/SqlClient.ParseToObject.svg)](https://www.nuget.org/packages/SqlClient.ParseToObject/)
[![NuGet Version](https://img.shields.io/nuget/v/SqlClient.ParseToObject.svg)](https://www.nuget.org/packages/SqlClient.ParseToObject/)# SqlClient.ParseToObject
Get a full object (with nested complex objects) from Microsoft.Data.SqlClient. Created with .NET Core support;
## Install via NuGet
```
PM> Install-Package SqlClient.ParseToObject
```## How to use
Optional Packages (to run next code):
```
Install-Package Dapper
```Demo Models:
```
public class UserModel
{
public string Id { get; set; }public string Name { get; set; }
public int Weight { get; set; }
public DateTime Birthdate{ get; set; }
public AddressModel Address { get; set; }
}public class AddressModel
{
public string Line1 { get; set; }public string Line2 { get; set; }
public string City { get; set; }
}
```Code:
```var query = @"SELECT
U.Cod AS Id,
Name,
Birthdate,
Weight,
A.Line1 as [Address.Line1],
A.Line2 as [Address.Line2],
A.City as [Address.City]
FROM User U INNER JOIN Address A ON U.AddressCod = A.Cod
WHERE Name = @Name";var parameters = new
{
Name = "Thiago Barradas"
};using (var sqlConnection = new SqlConnection(connectionString))
{
var reader = sqlConnection.ExecuteReader(query, parameters);List users = reader.GetResults();
}```
## How can I contribute?
Please, refer to [CONTRIBUTING](.github/CONTRIBUTING.md)## Found something strange or need a new feature?
Open a new Issue following our issue template [ISSUE TEMPLATE](.github/ISSUE_TEMPLATE.md)## Changelog
See in [nuget version history](https://www.nuget.org/packages/SqlClient.ParseToObject)## Did you like it? Please, make a donate :)
if you liked this project, please make a contribution and help to keep this and other initiatives, send me some Satochis.
BTC Wallet: `1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX`
![1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX](https://i.imgur.com/mN7ueoE.png)