GithubHelp home page GithubHelp logo

hasanaltan-cpu / dataaccessrepo Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 189 KB

In this project, we use data access tools as an Entity Framework.Initally you see definition of ORM then why we use EntityFramework then i will show some linq methods for database searches.In addition to that i will use Northwind database on SQL by using EntityFramework by DatabaseFirst approach & by CodeFirst approach.In a conclusion,i create a Phone Index For CRUD processes.

License: MIT License

C# 100.00%
database dataaccess entity-framework code-first orm dbfirst

dataaccessrepo's Introduction

DataAccessRepo

Table of contents

 -Part1(Linq Methods & Aggregrate Functions Example)


 -Part2(Mix Examples)

 -Part3(To Create Database by Approaching "Code First")

 -Part4(Example of CodeFirst:Yellow Pages PhoneNumber Index)
 
 -Part5(Explanation of LazyLoading&Eager Loading)

In this project,we use data access tools as an Entity Framework.

ORM(Object Relational Mapping)

What is an ORM?

Object-relational-mapping is the idea of being able to write queries , as well as much more complicated ones, using the object-oriented paradigm of your preferred programming language.

Entity FrameWork

Entity Framework is a tool for Object Relational Mapping.It is like a bridge between OOP and Relational Data Base.Entity Frame Work works as an assistans by getting data and bound your database object.Entity Framework works with Ado.Net.What is the Ado.Net? It contains UnitOfWork design pattern and written by Microsoft.For instance, adding, updating,deleting like this process we should create sentences String type.On the other hand,UnitOfWork doesn't need seperate all String process properly.It can manage these processes just by one source and u don't need to definite more String type. We can create a project by using 4 different path with EntityFrameWork:

1)Model First:

In this pattern, we create an empity modal file on the Visual Studio and add (.edmx) then we may design our database.At the compilation step Script file which is given creates database.

2)Database First:

Database First pattern provides automatic class creating by using Entity Framework.In this pattern Database should be created before tie up project as a modal.

3)Code First:By Code

In this pattern,All classes are created on the Visual Studio manually.Then Database derives from these classes.At that step Mapping processes can be manage thanks to Attributes.In addition to attributes Fluent Api and Fluent Validation can be used for Mapping process.

4)Code First:By Use Database

At this pattern, as wee read before,it is similar.It means,developer created classes and mapping codes. Database updates in terms of class and models situation.

3.What is Eager Loading

Eager loading is a technique where EF loads the related entities along with the main entity.All entities are loaded in a single query to database thus saving bandwidth and crucial server CPU time.This is done using "include method", which has two overloads.One of which takes navigation property as a string.the other "include method" is an extension method and far more flexible.In this tutorial,we learn how to make load the entities eagerly.We also show how to Eager Loading from multiple Levels and multiple Tables. One of the ways we can load entities eagerly by using the "include" method.Entity Framework creates a join query,when it sees the "include" method , thus bringing all the records in one single query. There are two versions of the include method available. The default method where you need to specify the navigational Property as a string. The other one from the System.Data.Entity namespace.It takes a lambda expression,where you need to specify the navigational Property.

What is Lazy Loading?

Lazy loading (also called on-demand loading) is an optimization technique for the online content, be it a website or a web app. Instead of loading the entire web page and rendering it to the user in one go as in bulk loading, the concept of lazy loading assists in loading only the required section and delays the remaining, until it is needed by the user.

Visit me https://hsnaltan13.gitbook.io/entity-framework-ef-ado-net

dataaccessrepo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dataaccessrepo's Issues

Dapper vs Entity Framework

In this repository, you have made applications in the light of theoretical information about Entity Framework and its technologies. Some say that Dapper implementing ORM architecture is better. What do you think?

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.