1470 热度

Testing Repository Pattern Using Entity Framework

Unit Testing is extremely important for creating robust software. It’s very simple in principle but it can get a little bit tricky when it comes to real-world applications that depend on databases. In this article, we’re going to explore some approaches to testing repository pattern in our ASP.NET Core applications, and we’re going to implement one of them.

收录时间: 2022-07-07
贡献者: Rector
1408 热度

Using Microsoft.Data.SqlClient with Entity Framework 6

Want to use Microsoft.Data.SqlClient with Entity Framework 6 - this is now possible! This blog post describes the why and how.

收录时间: 2021-08-09
贡献者: Rector
1257 热度

ORM Queries: Too Many Roundtrips

In Entity Framework, it’s easy to write code that will result in a “chatty” interaction with the database server. I wrote previously about being chatty in the context of read queries (lazy loading). This time, let’s talk about write queries.

收录时间: 2021-01-27
贡献者: Rector
1497 热度

Adding data to a very nested child object using EntityFramework

I am trying to add a note to my event object. I am getting an error using this code. Is there a better way to do it using Linq To Entity?...

收录时间: 2021-01-11
贡献者: Rector
1505 热度

Convert a sql query to the Entity Framework

Following sql query is working and gets the visits per day for the current month. For days I try to figure out how to get this running with the entity Framework. My best aproach so far ist this...

收录时间: 2021-01-11
贡献者: Rector
1626 热度

Entity Framework 3.1 Gotchas

I’ve recently been upgrading an EF Core 2.x project to EF Core 3.1. In doing so, I came across the issues in this post. Hopefully, next time, I’ll look here first!

收录时间: 2020-07-14
贡献者: Rector
AD 友情赞助
1578 热度

Create Small Blog in Blazor (3/4): Build Entity Framework Queries

We are continuing with building a small blog in Blazor. In the first edition, we went ahead and created our Blazor application in Visual Studio. Afterwards, we integrated Entity Framework into our Blazor application. Now, we are going to build up our Entity Framework queries needed for our blog.

收录时间: 2020-06-10
贡献者: Rector
2215 热度

EF多租户实例:快速实现分库分表

来到这篇随笔,我们继续演示如何实现EF多租户。今天主要是演示多租户下的变形,为下图所示  实施项目结构这次我们的示例项目进行了精简,仅有一个API项目,直接包含所有代码。其中Controller,StoreContext,Entity都完全和以往的示例一模一样,这里就不再过多介绍了。具有主要区别的是 CombinedConnectionGenerator 和 Startup   代码解释1. 首先要关注的是作为入口的 Startup ,还是一个套路,分别在 ConfigureService 注册EF多租户, 在 Configure 配置中间件。ConfigureService 还是一贯的简...

收录时间: 2020-04-04
贡献者: Rector
1805 热度

Using Reflection to Create a Dynamic OnModelCreating in Entity Framework

Reflection isn’t something new to the .NET library, but it’s as important as ever. Reflection provides objects that tells you more about the assemblies, types and modules in your project. You can use reflection for many things. For example, finding properties in a particular class. Or, invoking a me...

收录时间: 2020-03-25
贡献者: Rector
1749 热度

EntityFramework.Exceptions 3.1.1 - Support for Entity Framework Core 3 and Improved API

In the previous article I introduced EntityFramework.Exceptions, a library which simplifies handling exceptions in Entity Framework Core but the library had one important limitation: In order to use it you had to inherit your custom DbContext from ExceptionProcessorContextBase class. This means that if you wanted to use some other base class for your DbContext you were out of luck.

收录时间: 2020-03-14
贡献者: Rector
2100 热度

Entity Framework Core 3.1 和 Entity Framework 6.4 发布

目前,Entity Framework Core 3.1 和 Entity Framework 6.4 已正式发布。 EF Core 3.1的获取方式 EF Core 3.1 作为一组 NuGet 软件包专门分发。例如,要将 SQL Server 提供程序添加到您的项目...

收录时间: 2019-12-06
贡献者: Rector
1817 热度

Announcing Entity Framework Core 3.1 and Entity Framework 6.4

We are excited to announce the general availability of EF Core 3.1 and EF 6.4 on nuget.org. The final versions of .NET Core 3.1 and ASP.NET Core 3.1 are also available now.

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

Entity Framework Core 3.0 和 Entity Framework 6.3 正式发布

Entity Framework Core 3.0 和 Entity Framework 6.3 通用版发布了,接下来我们看看它的新内容:Entity Framework Core 3.0EF Core 3.0 包括主要特性、小部分增强和错误修复,以下是一些重要内容:LINQ overhaul重构了 LINQ Provider,以便能够将更多的查询模式转换为 SQL,在更多情况下生成高效的查询,并防止低效率的查询无法被检测到。新的 LINQ Provider 是能在未来版本中提供新的查询功能和性能改进的基础,而不会破坏现有的应用程序和数据提供程序。Cosmos DB 支持EF Core 的...

收录时间: 2019-09-25
贡献者: Rector
1949 热度

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

New previews of the next versions of EF Core and EF 6 are now available on NuGet.Org. What is new in EF Core 3.0 Preview 6. In recent months, a lot of our efforts have been focused on a new LINQ implementation for EF Core 3.0. Although the work isn’t complete and a lot of the intended functionality hasn’t been enabled, before preview 6 we reached a point in which we couldn’t make more progress without integrating the new implementation into the codebase in the main branch.

收录时间: 2019-06-14
贡献者: Rector
2715 热度

40 Breaking Changes in EF Core 3

In an attempt to correct many perceived deficiencies in Entity Framework Core, Microsoft is introducing 40 breaking changes to EF Core 3. You can see the entire breaking changes list on Microsoft Docs, but here are some of the highlights.

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

Using query tags with Entity Framework Core 2.2

Entity Framework 2.2 introduces query tags that make it easier to find specific queries from logs and output windows of Visual Studio. When running application on development box it’s possible to live without query tags. We can set breakpoints to see SQL generated from LINQ queries. But how to find queries from log files in multithreaded or multiuser scenarios?

收录时间: 2019-05-10
贡献者: Rector
3408 热度

C#/.NET应用程序开发中如何使用Entity Framework(EF)实现快速批量插入大量数据到SQL Server数据库?

如题,C#/.NET应用程序开发中如何使用Entity Framework(EF)实现快速批量插入大量数据到SQL Server数据库?这是很多.NET开发者会遇到的常见问题。由于Entity Framework(EF)本身没有内置批量插入大量数据到SQL Server数据库的功能,所以在处理这个问题的时候需要我们.NET开发者自己实现扩展或者帮助类。如果你非得要说可以,那使用AddRange()方法只能用于数据量较少的场景,数据量...

收录时间: 2019-05-07
贡献者: Rector
1935 热度

Implementing Missing Features in Entity Framework Core – Part 5: Getting the SQL for a Query

This will be the fifth post in a series of posts about bringing the features that were present in Entity Framework pre-Core into EF Core. The others are: Part 1: Introduction, Find, Getting an Entity’s Id Programmatically, Reload, Local, Evict Part 2: Explicit Loading Part 3: Validations Part 4: Conventions This time I’m going to talk about something that is often requested: how can I get the SQL string for a LINQ query? If you remember, in the pre-Core days you had to do some reflection in order to get the underlying ObjectQuery and then call its ToTraceString method. Now, things are very different, although I may say, still rather tricky!

收录时间: 2019-04-11
贡献者: Rector
2243 热度

Replacing existing entity framework code with Dapper

Developers choose Entity framework ORM (EF) for better productivity when accessing the database. But, when the product is built that went from bare bones to very complex and heavy data access then comes the performance.

收录时间: 2019-04-02
贡献者: Rector
2798 热度

Using EF Core's InMemory Provider To Store A "Database" In Memory

I've had several situations arise recently where I needed a database, but I didn't particularly want to go through the process of creating one on our test servers. On this latest occasion, I started wondering if it was possible to create a database in memory, so that I could just dispose of it when I no longer needed it.

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