GithubHelp home page GithubHelp logo

bc913 / efcore101 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 99 KB

An introductory Entity Framework Core repo for tuturial and training purposes

License: MIT License

C# 98.58% PowerShell 1.42%
dotnet-core efcore ef-core ef-code-first sqlite tutorial

efcore101's Introduction

Entity Framework Core Tutorial

Introduction

This repo provides an introduction to Entity Framework Core and it's basic usage with documentation.

What is EF Core?

As Microsoft documentation states

Entity Framework (EF) Core is a lightweight, extensible, open source and cross-platform version of the popular Entity Framework data access technology. EF Core can serve as an object-relational mapper (O/RM), enabling .NET developers to work with a database using .NET objects, and eliminating the need for most of the data-access code they usually need to write.

Documentation

This documentation mainly has a similar categorization as done in Microsoft's official documentation. I've gathered my notes with some examples as follows:

Repository

A sample EF Core repository is provided. It is tested on Windows OS. SQLite database provider is used. If you want to access database samples, I suggest using DB Browser for SQLite. Click here for details.

The repository is categorized based on the relationship types and corresponding unit tests are provided. Some might notice that DbContext classes are designed as to be parametric based on being Optional or Required. This is not an ideal way designing DbContext classes for production and is only provided for training purposes.

One can run each relationship type example as console application by commenting out the corresponding code snippet in Program.cs. I've tried to demonstrate each CRUD operation and their side effect for Optional and Required relationships where possible.

Unit tests are also provided to demonstrate some of the CRUD behaviors and their side effects in an isolated way. In-memory SQLite database provider is used for testing purposes. Nunit framework is used.

Runing all unit tests at once using Test Explorer might not work well. You might have to run the unit tests one by one where required.

RunMigration.ps1 Powershell script may not work correctly. I'll fix it soon.

Requirements

  • .Net Core 3.1
  • .Net Core CLI
  • NUnit

efcore101's People

Contributors

bc913 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.