Giter Club home page Giter Club logo

bestbuybestpractices-orm_dapper's Introduction

💻 MySQL Best Buy Database - ORM & DAPPER

By using Dapper, we can significantly reduce the amount of coding required for database writes. In this instance, I am using MySQL - Best Buy database (totally made up fields of course 🤖 ) as an example.

I created a .Net Core Console Application, added appsettings.json (with Git ignore), then added 3 Nuget packages: Dapper, Microsoft.Extensions.Configuration.Json package, and MySql.Data to config and connection string. I then created using C# the Class, IEnumerable Repository Interface, Repository Class, and Methods.

Dapper is a .NET compatible, NuGet library ORM that you can add to your project that will extend your IDbConnection interface. The Dapper Execute is designed for any database writes, like INSERT, UPDATE, and DELETE.

Reduce the amount of Code you write with Dapper:

Here is a side by side comparison of just using MySqlConnection (left) vs using Dapper (right): You might notice how much code is reduced by using the Dapper implementation!

sql vs dapper

Here's a snippet of the command when run:

console1 console2

Here's a snippet of My SQL:

sql

Here's a snippet of my C# Code:

code

I implemented ORM Dapper into my final project so please check it out! https://github.com/nancylee1/FinalProject.ASP.NET.CoreMVC-LoveLeeLuxWebStore

Feel free to connect with me here on GitHub or on LinkedIn (www.linkedin.com/in/nancylee7). Thanks for checking this out!

bestbuybestpractices-orm_dapper's People

Contributors

nancylee1 avatar

Watchers

 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.