官术网_书友最值得收藏!

Kickstart - Introduction to Entity Framework Core

I still remember the days when we were spending quite a lot of time on working with relational databases rather than just focusing on solving business problems; those days are definitely gone. To elaborate, let's jot down the issues we had before ORM:

  • Data access layers were not portable, which made it hard to change from one platform to another.
  • There were no abstractions, which forced us to write manual mapping between objected-oriented objects and data entities.
  • Vendor-specific SQL statements, which requires knowledge to port between different RDBMS systems.
  • Relied heavily on triggers and stored procedures.

The entire product development process shifted towards tools and open source platforms, and even Microsoft took that path from .NET Core onward. If we keep spending time on writing code which could be achieved through tools, we might end up looking like cavemen.

The Entity Framework was created to address this concern; it was not introduced with the initial .NET framework but rather was introduced in .NET Framework 3.5 SP1.

If we look closely, it was obvious that the .NET team built it for the following reasons:

  • To minimize the time spent by the developers/architects on stuff like abstractions and the portable data access layer
  • So that the developers do not require vendor specific SQL knowledge
  • So that we can build object-oriented business logic by eradicating triggers and SPs

This book uses Visual Studio 2017 (the latest at the time of writing) and ASP.NET Core 2.0 MVC with Entity Framework 2.0. Even though Entity Framework 2.0 is the latest version, it is still an evolving one, so it would take time for the .NET team to develop all the existing features of Entity Framework 6.2 based on the full .NET Framework.

We will cover the following topics here:

  • Prerequisites
  • Creating a new project
  • Installing Entity Framework 2.0
  • Data models
  • Database context
  • Registering the context in services (.Net Core DI)
  • Creating and seeding databases
  • Performing CRUD operations
主站蜘蛛池模板: 屏山县| 金山区| 平阴县| 云龙县| 密云县| 郧西县| 武平县| 建昌县| 泉州市| 大理市| 云阳县| 宁阳县| 分宜县| 诸暨市| 伊吾县| 宜州市| 察雅县| 县级市| 黄陵县| 册亨县| 鄂州市| 航空| 荣昌县| 宁安市| 通州区| 淅川县| 正镶白旗| 关岭| 遂川县| 合作市| 噶尔县| 安徽省| 当雄县| 长海县| 封开县| 台中县| 石首市| 西乡县| 肃宁县| 洞口县| 葫芦岛市|