61 热度

EntityFramework Core表名原理解析,让我来,揭开你神秘的面纱

上一节我们针对最开始抛出的异常只是进行了浅尝辄止的解析,是不是有点意犹未尽的感觉,是的,我也有这种感觉,看到这里相信您和我会有一些疑惑,要是我们接下来通过注解、Fluent APi、DbSet分别对表名进行如下设置,是否会抛出异常呢?若不是,有其优先级,那么其优先级到底是怎样的呢?内置具体是如何实现的呢?让我们从头开始揭开其神秘的面纱。EntityFramework Core表名原理解析我们暂不知道到底是否有其优先级还是会抛出异常,那么接下来我们进行如下配置(模型请参考上一节《https://www.cnblogs.com/CreateMyself/p/12175618.html》)进行原...

收录时间: 2020-01-16
贡献者: Rector
38 热度

Execute raw SQL commands in Entity Framework Core

I have never seen a real-life project where object-relational mapper generates 100% of needed SQL. There have always been those special cases when raw SQL commands are needed. In this post I will demonstrate how to run raw SQL commands in Entity Framework Commands and how to read data from database without DbSet and query types.

收录时间: 2020-01-08
贡献者: Rector
30 热度

I CAN MAKE THIS WORK...: EF Core 3.1 breaks left join with no navigation property

Just recently my team took on the challenge of upgrading our codebase from .NET Core 2.2 to .NET Core 3.1. Along the way we encountered a quirky issue which caused us much befuddlement. Should you be befuddled too, then maybe this can help you.

收录时间: 2020-01-08
贡献者: Rector
89 热度

EntityFramework Core 3多次Include导致查询性能低之解决方案

上述我们简单讲解了几个小问题,这节我们再来看看如标题EF Core中多次Include导致出现性能的问题,废话少说,直接开门见山。EntityFramework Core 3多次Include查询问题不要嫌弃我啰嗦,我们凡事从头开始讲解起,首先依然给出我们上一节的示例类...

收录时间: 2019-12-04
贡献者: Rector
75 热度

Implementing Query Specification pattern in Entity Framework Core

My previous blog post No need for repositories and unit of work with Entity Framework Core showed how Repository and Unit of Work patterns are already implemented in Entity Framework Code (and NHibernate) and how we can use IDataContext generalization to get ORM-s behind same interface. As I’m still trying to find out what’s the best place where to isolate queries without exposing IQueryable I started playing with Query Specification pattern.

收录时间: 2019-12-03
贡献者: Rector
72 热度

Readable fluent queries with Entity Framework Core

After my first experiments with Query Specification pattern on Entity Framework Core I came to interesting idea – why not using extension methods that wrap query specifications or add directly some more conditions to IQueryable the way that queries are easy to read. Here’s my experiment and thoughts of fluent readable queries.

收录时间: 2019-12-03
贡献者: Rector
AD 友情赞助
121 热度

EF Core For MySql查询中使用DateTime.Now作为查询条件的一个小问题

最近一直忙于手上澳洲线上项目的整体迁移和升级的准备工作,导致博客和公众号停更。本周终于艰难的完成了任务,借此机会,总结一下项目中遇到的一些问题。EF Core一直是我们团队中中小型项目常用的ORM框架,在使用SQL Server作为持久化仓储的场景一下,一直表现还中规中矩。但是在本次项目中,项目使用了MySql作为持久化仓储。为了与EF Core集成,团队使用了Pomelo.EntityFrameworkCore.MySql作为EF Core For MySql的扩展。在开发过程中,团队遇到了各种各样在SQL Server场景下没有遇到过的问题,其中最奇怪的,也是隐藏最深的问题,就是将Da...

收录时间: 2019-11-26
贡献者: Rector
111 热度

Entity Framework Core and MySQL

From all the articles written on ASP.NET Core, Entity Framework Core and newer versions of MySQL, connecting the three should be a piece of cake in theory. And, as we all know, theory and practice are the same thing… in theory. However, on a recent project I actually needed to connect the three myse...

收录时间: 2019-11-25
贡献者: Rector
77 热度

Accidental caching of Entity Framework objects and how to detect EF objects

In our solution we’ve had problems with accidental caching of EF objects. We have our own memory cache implementation, one for each service, that we try to keep in sync across services as the services can cache the same objects. Inconsistency in the cache can be a big problem, not to mention difficult to debug, and by caching EF objects we add to the problem as we cache relational data that might have changes somewhere else...

收录时间: 2019-11-22
贡献者: Rector
104 热度

Entity Framework Core 3.0: A Foundation for the Future

As .NET Core has evolved, Entity Framework Core (EF Core) has grown increasingly sophisticated from one version to the next. EF Core was a ground-up rewrite of the tried-and-true Entity Framework that began its life in 2008 and matured as it grew to version 6, originally released in 2013. The vision with EF Core was to remove barriers to modernization by shedding EF’s old code base.

收录时间: 2019-11-09
贡献者: Rector
123 热度

How to Configure Entity Framework Caching

The Entity Framework is a set of technologies in ADO.NET that support the development of data-oriented software applications. With the Entity Framework, developers can work at a higher level of abstraction when they deal with data and can create and maintain data-oriented applications with less code than in traditional applications...

收录时间: 2019-10-18
贡献者: Rector
161 热度

Release Candidate builds of Entity Framework Core 3.0 and Entity Framework 6.3 are now available

We previously said that preview 9 would be your last chance to test EF Core 3.0 and EF 6.3 before general availability. But it turns out that we made enough improvements to our libraries and across the whole of .NET Core 3.0 to justify publishing a release candidate build. Hence the packages for EF Core 3.0 RC1 and EF 6.3 RC1 were uploaded to nuget.org today.

收录时间: 2019-09-17
贡献者: Rector
139 热度

How to Configure PostgreSQL in Entity Framework Core

In this article, we are going to learn how to configure PostgreSQL, a popular and reliable open-source relational database, in our .NET Core application, and connect it to Entity Framework Core to utilize its full potential.If you want to learn more about Entity Framework Core and how to configure i...

收录时间: 2019-09-10
贡献者: Rector
230 热度

Announcing Entity Framework Core 3.0 Preview 9 and Entity Framework 6.3 Preview 9

The Preview 9 versions of the EF Core 3.0 package and the EF 6.3 package are now available for download from nuget.org.

收录时间: 2019-09-06
贡献者: Rector
120 热度

Modifying Data with Entity Famework Core

Until now, we have talked about the EF Core integration into the ASP.NET Core app, how to configure nonrelational properties and how to create relationships in EF Core. Additionally, we talked about migrations and the way to use queries to fetch the data from the database.So now, to wrap up this ser...

收录时间: 2019-09-04
贡献者: Rector
AD 友情赞助
198 热度

Database Queries in Entity Framework Core

In this chapter, we are going to talk about Queries in Entity Framework Core. In previous articles, we have already created and prepared the database with the required configuration. So, in this one, we are going to populate our additional tables with data and start writing some queries.We are going...

收录时间: 2019-08-27
贡献者: Rector
169 热度

EF Core Relationships - Convention, Data Annotations and Fluent API

In the second part of this series, we have learned how to configure non-relational properties in Entity Framework Core. So as a logical continuation, this article will be dedicated to learning about database relationships configuration with Entity Framework Core (EF Core Relationships).

收录时间: 2019-08-20
贡献者: Rector
198 热度

Announcing Entity Framework Core 3.0 Preview 8 and Entity Framework 6.3 Preview 8

The Preview 8 versions of the EF Core 3.0 package and the EF 6.3 package are now available for download from nuget.org.

收录时间: 2019-08-14
贡献者: Rector
206 热度

Migrations and Seed Data with Entity Framework Core

In this section, we are going to cover Migrations and Seed data features in Entity Framework Core.In the previous parts of this series, we have created the database model (entity and context classes) and applied different configuration options. Now it is time to transfer this database model to the real database in SQL server. Our SQL database schema needs to be aligned with our application’s database model and using migrations will help us keep things that way.

收录时间: 2019-08-13
贡献者: Rector
163 热度

EF Core Configuraton of Nonrelational Properties

In the previous article, we have created a basic setup for Entity Framework Core in our ASP.NET Core project. In this article, we are going to talk about the EF Core configuration and the different configuration approaches.You can download the source codefor this article on our GitHub repository.To ...

收录时间: 2019-08-06
贡献者: Rector
AD 友情赞助