220 热度

EFCore3.1+编写自定义的EF.Functions扩展方法

本文主要是讲解EF Core3.0+ 如何实现自定义的数据库扩展函数虽然EF.Functions 提供了很多数据库函数,但是并不全面.比如加密解密..这样的话 我们就需要自己扩展这些数据库函数 从而达到调用的目的.本文以达梦数据库为例(其他数据库都一样)..上篇文章推荐:EF Core3.0+ 通过拦截器实现读写分离与SQL日志记录 正文1.创建扩展方法首先我们需要创建自定义的扩展方法如下...

收录时间: 2021-04-14
贡献者: Rector
226 热度

Entity Framework Core之工作单元的封装

工作单元:维护受事务影响的对象列表,并协调对象改变的持久化和解决并发场景的问题.在 EntityFrameworkCore 中使用 DbContext 封装了;实体对象状态记录跟踪;数据库的交互;数据库事务。关于协调对象改变的持久化是通过调用 DbContext 的相关方法实现的。在并发场景下 DbContext 的使用也完全交给了开发者处理,主要靠文档规范说明 DbContext 的使用。

收录时间: 2021-03-17
贡献者: Rector
122 热度

EF Core中通过Fluent API完成对表的配置

EF Core中通过Fluent API完成对表的配置,设置实体在数据库中的表名,通过ToTable可以为数据模型在数据库中自定义表名,如果不配置,则表名为模型名的复数形式...

收录时间: 2021-03-08
贡献者: Rector
151 热度

Streaming Vs. Buffered Results With Entity Framework Core 5

Working with databases means writing queries, getting results, measuring performance, and then optimizing. The cycle never ends. Luckily, for Entity Framework Core 5 (EF Core) users, we have a few options for optimizing our queries. With an IDE like JetBrains Rider, we have tools to understand the benefits we get from our code changes.

收录时间: 2021-03-03
贡献者: Rector
180 热度

Entity Framework Core 5 Value Converters

This post will look at an extensibility point that many folks will appreciate, especially when dealing with C# objects that we can manage with identifiers. Let’s dive right into Value Converters for EF Core 5.

收录时间: 2021-02-26
贡献者: Rector
180 热度

EntityFramework Core如何映射动态模型?

本文我们来探讨下映射动态模型的几种方式,相信一部分童鞋项目有这样的需求,比如每天/每小时等生成一张表,此种动态模型映射非常常见,经我摸索,这里给出每一步详细思路,希望能帮助到没有任何头绪的童鞋,本文以.NET Core 3.1控制台,同时以SQL Server数据库作为示例演示(其他数据库同理照搬),由于会用到内置APi,因版本不同可能比如构造函数需略微进行调整即可。注:虽为示例代码,但我将其作为实际项目皆已进行封装,基本完全通用。本文略长,请耐心。

收录时间: 2021-01-25
贡献者: Rector
AD 友情赞助
148 热度

Bulk copy with Entity Framework Core 5

MS SQL Server provides functionality to quickly insert large amounts of data. It is called Bulk Copy and is performed by SqlBulkCopy class. I already compared how fast is it compared to EF Core 5 in this post: https://www.michalbialecki.com/2020/05/03/entity-framework-core-5-vs-sqlbulkcopy-2/, but this time I want to check something different – linq2db library.

收录时间: 2021-01-23
贡献者: Rector
174 热度

The Plan for Entity Framework Core 6.0

Today we are excited to share with you the plan for Entity Framework Core 6.0. This plan brings together input from many stakeholders and outlines where and how we intend to invest for the Entity Framework (EF Core) 6.0 release. This plan is not set-in-stone and will evolve as we work on the release based on what we learn. This learning includes feedback from people like you, so please let us know what you think!

收录时间: 2021-01-20
贡献者: Rector
171 热度

Entity Framework Core 5 Resources I’ve Created Recently

Whether you are new to EF / EF Core or moving from an earlier version, I’ve been pretty busy creating a number of useful resources for you whether you prefer to learn by video, reading or listening!

收录时间: 2021-01-18
贡献者: Rector
254 热度

Investigating Memory Leaks in EF Core

For reasons beyond the scope of this post, I recently implemented an interface between a front-end web application and a MySQL database to facilitate dynamic filtering against different tables and columns (It's not as bonkers as sounds, model properties must be configured as filterable first!). The project requirements ruled out more conventional solutions like OData, and so I had to implement the bridge myself.

收录时间: 2020-12-15
贡献者: Rector
215 热度

Unit tests in Entity Framework Core 5

Tests are an integral part of software development. These are separate programs that allow you to check if a piece of the program written by us does exactly what it should. Unit tests are small pieces of code that test individual program elements and in Entity Framework Core 5 it’s surprisingly easy to write them.

收录时间: 2020-12-01
贡献者: Rector
258 热度

Getting Started With Entity Framework Core 5

In this post, we’ll see how we can get started with EF Core 5. We’ll design a schema for entertainment productions using a code-first approach, migrate an SQLite database to our schema’s current incarnation, seed our database, and run some typical LINQ queries.

收录时间: 2020-11-28
贡献者: Rector
270 热度

EFCore 5 中的 DbContextFactory

使用过 EF Core 大多都会遇到这样一个场景,希望能够并行查询,但是如果使用同一个 DbContext 实例进行并行操作的时候就会遇到一个 InvalidOperationException 的异常,在 EF Core 2.x/3.x 版本中, EF Core DbContext 的生命周期默认是 Scoped,如果要并行查询,需要创建多个 Scope,在子 Scope 中创建 DbContext 来进行操作,EF Core 5 中的 DbContextFactory 可以用来简化这样的操作,且看下文示例

收录时间: 2020-11-20
贡献者: Rector
379 热度

EF Core 5 Many-to-Many Relationships

If you're a Microsoft developer using EF Core, you are probably really excited about the new feature in EF Core 5 that makes creating many-to-many relationships super simple! Many-to-many relationships in EF Core 5 work intuitively now, so if you have installed the .NET 5 SDK or Visual Studio 2019 16.9 preview 1 you can test the new feature pretty quickly from a .NET Core Console Application targeting .NET 5. In this EF Core 5 tutorial, I will walk you through the standard sample application of building a many-to-many relationship between blog posts and tags in a SQLite database.

收录时间: 2020-11-16
贡献者: Rector
261 热度

Announcing the Release of EF Core 5.0

Today, the Entity Framework team is delighted to announce the release of EF Core 5.0. This is a general availability/release to manufacturing (GA/RTM) release that addresses final bugs identified in the previous release candidates and is ready for production. EF Core 5.0 is released simultaneously with .NET 5.0.

收录时间: 2020-11-12
贡献者: Rector
AD 友情赞助
302 热度

Help Us Plan EF Core 6.0

Entity Framework Core 5.0 will soon be released in conjunction with .NET 5. The release is a major milestone in the long history of Entity Framework that began before version 1.0 was shipped with .NET Framework 3.5 Service Pack 1 in 2008. EF Core 5.0 is cross-platform and supports all of the most popular relational databases. It also provides a consistent API to interface with the popular NoSQL Azure Cosmos DB database. EF Core 5.0 includes scores of new features ranging from “many-to-many” and “table-per-type” to an updated migrations experience. The team is currently focused on bug fixes, updates to documentation, and planning for the next release.

收录时间: 2020-10-29
贡献者: Rector
276 热度

Announcing Entity Framework Core (EF Core) 5 RC2

Today, the Entity Framework Core team announces the second release candidate (RC2) of EF Core 5.0. This is a feature complete release candidate of EF Core 5.0 and ships with a "go live" license. You are supported using it in production. This is a great opportunity to start using EF Core 5.0 early while there is still time to fix remaining issues. We're looking for reports of any remaining critical bugs that should be fixed before the final release.

收录时间: 2020-10-15
贡献者: Rector
318 热度

How not to pass parameters in Entity Framework Core 5

Recently I wrote a post about executing raw SQL scripts in Entity Framework Core 5: Executing raw SQL with Entity Framework Core 5. One of the readers noticed that I did a big mistake when passing parameters. Let’s take a closed look.

收录时间: 2020-09-28
贡献者: Rector
312 热度

Announcing Entity Framework Core (EFCore) 5.0 RC1

Today, the Entity Framework Core team announces the first release candidate (RC1) of EF Core 5.0. This is a feature complete release candidate of EF Core 5.0 and ships with a "go live" license. You are supported using it in production. This is a great opportunity to start using EF Core 5.0 early while there is still time to fix remaining issues. We're looking for reports of any remaining critical bugs that should be fixed before the final release.

收录时间: 2020-09-16
贡献者: Rector
403 热度

Executing raw SQL with Entity Framework Core 5

Entity Framework Core 5 is an open-source, lightweight, extensible, and a cross-platform ORM. It is easy to apply and it makes database access super simple. However, sometimes working with tables and views is just not enough. How to execute raw SQL script with Entity Framework Core 5? Let’s find out.

收录时间: 2020-09-16
贡献者: Rector
AD 友情赞助