Giter Club home page Giter Club logo

snikt's Introduction

SNIKT!

StackShare Gitter Stories in Ready

Snkit! is nothing but a light-weight micro-ORM. Originally, it is the switchblade-sound of Wolverine's claws locking into place.

OVERVIEW

I wrote Snikt! to take away the pain of data access logic.

  • It is a simple Assembly you can refer in your Data Access Layer that will provide utilities, wrappers, and extensions to simplify work in the data access objects.
  • Snikt! provides database connection lifetime management and execution store commands.
  • It materialize CLR-types given a data reader as well as result set of a store command.
  • It has templates and abstract classes for business entities, data access objects, and search query arguments.
  • Snikt! has no database specific implementations. Technically, you should be able to use it on MySQL, SQL Server, or even on Oracle.

LICENSE

Snikt! code is free for commercial and non-commercial deployments and distribution. Snikt! is release under MIT License.

FEATURES

Snikt! provides 3 simple helpers:

Map query results to a strong-typed list

IDataReader queryResult = command.ExecuteReader();
Materializer<Category> categoryMaterializer = new Materializer<Category>(queryResult);
List<Category> categories = new List<Category>();
while (queryResult.Read())
{
    categories.Add(categoryMaterializer.Materialize(queryResult));
}

Assert.IsTrue(categories.Any());

Execute a Stored Procedure

IDatabase db = new Database("name=DefaultConnection");

List<Category> categories = db.SqlQuery<Category>("dbo.GetAllCategories").ToList();

Assert.IsTrue(categories.Any());

Execute a Stored Procedure that obtain Parameters

IDatabase db = new Database("name=DefaultConnection");
var criteria = new { Id = 1 };

List<Category> categories = db.SqlQuery<Category>("dbo.GetCategory", criteria).ToList();

foreach (Category cat in categories)
{
    Assert.AreEqual(criteria.Id, cat.Id);
}

Provide DbContext as the Connection

public class DbContextConnectionFactory : IDbConnectionFactory
{
    public IDbConnection CreateIfNotExists(string nameOrConnectionString)
    {
		MiniNWDbContext dbContext = new MiniNWDbContext("name=DefaultConnection");
        return dbContext.Database.Connection;
    }
}

IDatabase db = new Database("name=DefaultConnection", new DbContextConnectionFactory());
List<Category> categories = db.SqlQuery<Category>("dbo.GetAllCategories").ToList();
Assert.IsTrue(categories.Any());

OTHER RESOURCES

Snikt! is created to demonstrate How to apply some of the available .NET technologies with the Data Access Layer in Layered Architecture design pattern. The main focus of the specifications is How to code the Data Access Layer? and not the actual functionality of the chosen MiniNW application.

/KP
e: [email protected]
t: @kosalanuwan
b: http://kosalanuwan.tumblr.com

snikt's People

Contributors

kosalanuwan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.