Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

markdown# Maestria.Extensions.Data

NuGet Version NuGet Downloads Apimundo


buy-me-a-coffee smile.png

If my contributions helped you, please help me buy a coffee :D

donate


What is Maestria.Extensions.Data?

Extension functions package for IDataReader implementations.

What is Maestria Project?

This library is part of Maestria Project.

Maestria is a project to provide maximum productivity and elegance to your code.

Where can I get it?

Install the Maestria.Extensions.Data using the command line:

dotnet add package Maestria.Extensions.Data

How do I get started?

First, import "Maestria.Extensions.Data" reference:

using Maestria.Extensions.Data;

Then in your application code, use fluent syntax to obtain field value:

// Configuring data connection
var connection = // your .net data provider db connection
var cmd = connection.CreateCommand();
cmd.CommandText = "select * from...";
var reader = cmd.ExecuteReader();
reader.Read();

// In this case throw exception when field value is null
var int16Value = reader.GetInt16("fieldName");
var int32Value = reader.GetInt32("fieldName");
var decimalValue = reader.GetDecimal("fieldName");

// With safe method when field value is null, it will return default value of the second argument or INullable<?> for data type 
var decimalSafeValue = reader.GetDecimalSafe("fieldName", 0);   // output is 0 when invalid field value 
var decimalSafeValue2 = reader.GetDecimalSafe("fieldName");     // output is nyll when invalid field value

// But safe methods, throw exception when field name is invalid
var temp = reader.GetDecimalSafe("invalid field name"); // throw IndexOutOfRangeException

buy-me-a-coffee smile.png

If my contributions helped you, please help me buy a coffee :D

donate

About

Extension functions package for IDataReader implementations.

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages