-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)
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 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:
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.
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.
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.
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.
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.
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