{"id":388423,"date":"2024-06-29T07:55:55","date_gmt":"2024-06-29T07:55:55","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=388423"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T07:55:55","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=388423","title":{"rendered":"<span>Entity Framework Core \u0438 \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Entity Framework Core \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0438 \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 ASP NET Core. \u042d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u043d\u043e, \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u0442\u043e\u0432\u0430\u043b\u043e \u043c\u043d\u0435\u043d\u0438\u0435 (\u0438 \u043d\u0435 \u0431\u0435\u0437\u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u0447\u0442\u043e Entity Framework \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Dapper. \u041d\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0434\u0435\u0442 \u0438 Entity Framework \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u043e\u043c\u0438\u043c\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0430\u043c\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b .NET, Entity Framework Core \u0434\u043b\u044f NET 6 \u0438\u043c\u0435\u0435\u0442 \u0440\u044f\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c Entity Framework Core \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0435\u0433\u043e \u0441 Dapper \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u044e\u043b\u044f 2022 \u0433\u043e\u0434\u0430. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f &#171;\u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0438\u0442\u0435 \u0432\u0441\u0435 \u043d\u0430 Dapper&#187; \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \ud83d\ude42<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 Entity Framework Core \u0432 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0434\u043b\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u043d\u0430\u043d\u0438\u0439 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 Entity Framework Core. <\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 EF<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u0435\u043c \u0432 \u0442\u0435\u043c\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 EF \u0438 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u043c \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0418\u0442\u0430\u043a, EF \u044d\u0442\u043e object-relational mapper (ORM) \u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 \u043a\u043e\u0434\u0435 (C# \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430) \u0441 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (\u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u0437\u0430\u043f\u0438\u0441\u044c, \u0441\u0432\u044f\u0437\u0438 etc). \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 EF \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u043e\u0442 <code>DbContext<\/code>. \u041a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043d\u0430\u0431\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432-\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439 <code>DbSet<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u044d\u0442\u0438\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 SQL \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>ToArray<\/code>, <code>ToList<\/code>, <code>FirstOrDefault<\/code> \u0438 \u0442.\u0434., \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 C# \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. <\/p>\n<pre><code class=\"cs\">public class AdventureWorksContext : DbContext {     public virtual DbSet&lt;Product> Products { get; set; }     ... } ... public void ApplicationLogic() {     using var context = new AdventureWorksContext();     \/\/ get list of products with filter     var bookProducts = context.Products.Where(p => p.Type == \"Book\").ToList();     \/\/ get single product by name     var singleBook = context.Products.Where(p => p.Name == \"Harry Potter\").FirstOrDefault();     \/\/ do data handling     ... }<\/code><\/pre>\n<p>\u0422\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, EF \u0434\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, EF \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0445 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0445 \u043e\u0442 SQL \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 C# \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 MSSQL, Oracle \u0438 MySQL. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQL \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, EF \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (change-tracking) \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c Update \u0438 Delete \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043a\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0431\u043e SQL \u043a\u043e\u0434\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"cs\">public void ApplicationLogic() {     using var context = new AdventureWorksContext();     var bookProduct = context.Products.Where(p => p.Name == \"Harry Potter\").Single();     bookProduct.Name = \"Harry Potter and the Sorcerer's Stone\"     context.SaveChanges();     \/\/ name in DB was updated !       context.Remove(bookProduct);     context.SaveChanges();     \/\/ book was deleted from DB !     ... }<\/code><\/pre>\n<p>EF \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u0433\u0430\u0442\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u0446\u0435\u043d\u0443 \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u044b EF \u043e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <code>DbContext<\/code>. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>DbContext<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 SQL. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IQueryable<\/code>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f LINQ \u043d\u0430 <code>DbSet<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c. \u041e\u0431\u044a\u0435\u043a\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 builder-\u0430: \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Where<\/code>, <code>OrderBy<\/code>, <code>Select<\/code> \u0438 \u0442.\u0434. \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u043e\u0432\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 SQL. <code>IQueryable<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <code>IEnumerable<\/code>, \u043d\u043e \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432\u044b \u043d\u0435 \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b <code>IEnumerable<\/code> (\u0438\u043b\u0438 <code>IAsyncEnumerable<\/code>) \u044f\u0432\u043d\u043e &#8212; SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0431\u0430\u0437\u0443. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043d\u0430 <code>IQueryable<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u0430, \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043a <code>IEnumerable<\/code> (\u0438\u043b\u0438 <code>IAsyncEnumerable<\/code>), \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u043a <code>ToArray<\/code>, <code>ToList<\/code>, <code>FirstOrDefault<\/code> \u0438 \u0442.\u0434. \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438. EF \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>IQueryable<\/code> \u0432 SQL, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043a\u044d\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 (server-side calculations).<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 C# \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 (change-tracking). \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, EF \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>SaveChanges<\/code> \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 Update \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u043d\u0435\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0442\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (client-side calculations). \u041f\u043e\u043b\u0443\u0447\u0430\u044f LINQ \u0437\u0430\u043f\u0440\u043e\u0441 EF \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 SQL \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (server-side calculation). \u041d\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 SQL \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0412 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 EF Core \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043c\u043e\u0433 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u0447\u0442\u043e EF \u043d\u0435 \u0441\u043c\u043e\u0433 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 SQL \u0438 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435\u044f\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043b\u043e\u0433\u043e\u0432, \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0432 \u0432\u044b\u0431\u0440\u043e\u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445, \u043f\u0440\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c LINQ \u0432 SQL EF \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0442\u0440\u0435\u0431\u0443\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>AsEnumerable<\/code>, <code>ToList<\/code> \u0438 \u0442.\u0434. \u043f\u0435\u0440\u0435\u0434 \u0447\u0430\u0441\u0442\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 C# (client-side calculations). \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/querying\/client-eval\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 Microsoft<\/a>. \u0412 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0431\u043b\u043e\u043a\u0435 <code>Where<\/code>, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c <code>DbContext<\/code>, \u0432\u044b\u0437\u043e\u0432\u043e\u043c ADO NET \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445, \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u044f GC, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0438 \u043e\u0447\u0438\u0449\u0430\u044e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043a\u044d\u0448\u0438 \u0438 \u0442.\u0434. Dapper \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 ADO NET \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u043b\u0438\u0448\u0435\u043d\u043d\u0443\u044e \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 EF, \u043d\u043e \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Dapper:<\/p>\n<pre><code class=\"cs\">public void ApplicationLogic() {     using var sqlConnection = new SqlConnection(connectionString);     var product = connection.QuerySingleOrDefault&lt;Product>(@\"         select * from Products          where Name = @name     \", new { name = \"Harry Potter\" }); }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 EF \u0438 \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043e\u0431\u0437\u043e\u0440\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c.<\/p>\n<h2>System Under Test (SUT)<\/h2>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0435\u0431 API, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 SQL \u0431\u0430\u0437\u043e\u0439 AdventureWorks, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432:<\/p>\n<ul>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e Id \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. <em>Get product by Id<\/em>;<\/p>\n<\/li>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e Id \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 (JOIN-s). <em>Get product with model and product category by id<\/em>;<\/p>\n<\/li>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. <em>Get products page<\/em>;<\/p>\n<\/li>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 (JOIN-s). <em>Get products page with model and product category datas<\/em>;<\/p>\n<\/li>\n<li>\n<p>POST \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435. <em>Create product<\/em><\/p>\n<\/li>\n<li>\n<p>PUT \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. <em>Edit product name<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c API \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <code>IProductsRepository<\/code> \u043d\u0430 \u0431\u0430\u0437\u0435 EF \u0438\u043b\u0438 Dapper \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c NBomber \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e NBomber \u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/664824\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/MrPomidor\/EFCorePerformanceTipsDemo\/tree\/master\/src\/Solution\/Tests\/Benchmarks\" rel=\"noopener noreferrer nofollow\">BenchmarkDotNet \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043d\u0430\u0448\u0435 API \u0432 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IProductsRepository<\/code> \u0434\u043b\u044f EF, Dapper \u0438 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 EF \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"cs\">private ServiceProvider EFCoreDefaultImplementationServiceProvider; ... [GlobalSetup] public void GlobalSetup() {     BuildDefaultImplementationServiceProvider(); } ... [Benchmark] public async Task GetProduct_Benchmark() {     \/\/ we will do several iterations, emulating several requests, to see difference in time and memory better     for (int i = 0; i &lt; IterationsCount; i++)     {         \/\/ as for each HTTP request in web api, we will create DI scope         using var scope = EFCoreDefaultImplementationServiceProvider.CreateScope();         \/\/ ... from which we will resolve implementation under test          var repository = scope.ServiceProvider.GetRequiredService&lt;IProductsRepository>();         \/\/ get product by id scenario as example         var product = await repository.GetProduct(ProductIds[i % (ProductIds.Length - 1)]);     } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u0435 <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/performance\/advanced-performance-topics\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438<\/a> \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b EF, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d NBomber \u0442\u0435\u0441\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/MrPomidor\/EFCorePerformanceTipsDemo\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 Github<\/a>.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0437\u0430\u043c\u0435\u0440 \u0434\u043b\u044f Dapper \u0438 \u0432\u0435\u0440\u0441\u0438\u0438 EF &#171;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&#187;. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u043e\u0431\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f 30 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0431\u0435\u0437\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u043e \u0448\u043b\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b0b\/c06\/4d1\/b0bc064d1ba573a1f5690822c27aeb9e.png\" alt=\"EF Default and Dapper\" title=\"EF Default and Dapper\" width=\"1876\" height=\"1016\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b0b\/c06\/4d1\/b0bc064d1ba573a1f5690822c27aeb9e.png\"\/><figcaption>EF Default and Dapper<\/figcaption><\/figure>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Scenario<\/p>\n<\/td>\n<td>\n<p align=\"left\">EF Default (RPS)<\/p>\n<\/td>\n<td>\n<p align=\"left\">Dapper (RPS)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get product by Id<\/p>\n<\/td>\n<td>\n<p align=\"left\">7124,1<\/p>\n<\/td>\n<td>\n<p align=\"left\">8478,0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get detailed product by Id<\/p>\n<\/td>\n<td>\n<p align=\"left\">6180,5<\/p>\n<\/td>\n<td>\n<p align=\"left\">7439,9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get products page<\/p>\n<\/td>\n<td>\n<p align=\"left\">3320,7<\/p>\n<\/td>\n<td>\n<p align=\"left\">4341,2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get detailed products page<\/p>\n<\/td>\n<td>\n<p align=\"left\">1174,8<\/p>\n<\/td>\n<td>\n<p align=\"left\">954,8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Create product<\/p>\n<\/td>\n<td>\n<p align=\"left\">2146,2<\/p>\n<\/td>\n<td>\n<p align=\"left\">3967,9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Edit product<\/p>\n<\/td>\n<td>\n<p align=\"left\">1859,8<\/p>\n<\/td>\n<td>\n<p align=\"left\">4371,7<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 EF \u043d\u0430 <strong>19-30<\/strong> \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 Dapper \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0442\u043e\u0447\u043a\u0443 \u043e\u0442\u0441\u0447\u0435\u0442\u0430 \u0438 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<h2>DbContext pooling<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 EF \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435, \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0438 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043d\u0430\u043f\u0435\u0440\u0435\u0434 (pre-calculation). Microsoft <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/performance\/advanced-performance-topics#dbcontext-pooling\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u043b \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0442\u0438\u043f\u0430 <code>DbContext<\/code>. \u041f\u043b\u044e\u0441\u044b \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b &#8212; \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 &#171;\u0442\u044f\u0436\u0435\u043b\u044b\u0445&#187; \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 GC \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435. \u0422\u0430\u043a\u0436\u0435 \u0441\u0440\u0435\u0434\u0438 \u043f\u043b\u044e\u0441\u043e\u0432 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 &#8212; \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0443\u043b\u0438\u043d\u0433\u0430 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0432\u044b\u0437\u043e\u0432 <code>AddDbContext<\/code> \u043d\u0430 <code>AddDbContextPool<\/code> \u0432 Program.cs. \u0412\u0430\u0448 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>IProductsRepository<\/code>) \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u0442\u0440\u043e\u043d\u0443\u0442\u044b\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u0432\u0430\u0448 <code>DbContext<\/code> \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u043e\u043c \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 scoped \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0441\u043f\u043e\u0441\u043e\u0431 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u044b\u043b <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/performance\/advanced-performance-topics#managing-state-in-pooled-contexts\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0438 \u043e\u043f\u0438\u0441\u0430\u043d<\/a> \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 EF. \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0443\u043b\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b <code>DbContext<\/code>.<\/p>\n<pre><code class=\"cs\">public static void AddEfCore(this IServiceCollection services, IConfiguration config) {     \/\/services.AddDbContext&lt;AdventureWorksContext>((dbContextConfig) =>     services.AddDbContextPool&lt;AdventureWorksContext>((dbContextConfig) =>     {         dbContextConfig.UseSqlServer(config.GetConnectionString(ConnectionStringName));     });      services.AddScoped&lt;IProductsRepository, EFCoreProductsRepository>(); }<\/code><\/pre>\n<h2>\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 \u0434\u043b\u044f read-only \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b EF \u043c\u044b \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/querying\/tracking\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/a>. Change-tracking \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 SQL Update \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u042d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0432\u044b\u0437\u0432\u0430\u0432 \u043c\u0435\u0442\u043e\u0434 <code>AsNoTracking<\/code>.<\/p>\n<pre><code class=\"cs\">public async Task&lt;Product> GetProduct(int productId, CancellationToken cancellationToken = default) {     return await _context.Products         .AsNoTracking()         .FirstOrDefaultAsync(x => x.ProductId == productId, cancellationToken); }<\/code><\/pre>\n<p>\u0417\u0430 \u043f\u0430\u0440\u0443 \u043b\u0435\u0442 \u044f \u0437\u0430\u0432\u0435\u043b \u0441\u0435\u0431\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0443 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0447\u0435\u0440\u0435\u0437 <code>AsNoTracking<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0430\u0449\u0435 \u0447\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0442\u043e \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>AsNoTracking<\/code> \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u0441\u044f \u0447\u0442\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435 \u0441\u043b\u043e\u043c\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 EF \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <code>AsNoTracking<\/code> \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432 \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <code>AddDbContext<\/code>. \u0422\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 <code>AsTracking<\/code> \u0432 \u0442\u0435\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445, \u0433\u0434\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e-\u0442\u043e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cs\">public static void AddEfCore(this IServiceCollection services, IConfiguration config) {     services.AddDbContext&lt;AdventureWorksContext>((dbContextConfig) =>     {         ...         dbContextConfig.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);     }); }  public void ApplicationLogic() {     using var context = new AdventureWorksContext();     var bookProduct = context.Products.AsTracking().Where(p => p.Name == \"Harry Potter\").Single();     bookProduct.Name = \"Harry Potter and the Sorcerer's Stone\"     context.SaveChanges(); }<\/code><\/pre>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 DbContext.Entry \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (Edit product), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c Dapper \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442 EF \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0432 2 \u0440\u0430\u0437\u0430. \u0422\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c, \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0432 \u043d\u0430 \u043a\u043e\u0434 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 <code>IProductsRepository<\/code> \u0434\u043b\u044f EF:<\/p>\n<pre><code class=\"cs\">... var bookProduct = dbContext.Products.Where(p => p.Name == \"Harry Potter\").Single(); \/\/ &lt; -- 1-st query to db bookProduct.Name = \"Harry Potter and the Sorcerer's Stone\" context.SaveChanges(); \/\/ &lt;-- 2-nd query to DB ...<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e C# \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>SaveChanges<\/code>, \u0447\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u0432\u0443\u043a\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e Dapper \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e EF \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c C# \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 2 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 EF \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c C#, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>Product<\/code>, \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cs\">public async Task EditProductName(int productId, string productName) {     var product = new Product { ProductId = productId, Name = productName };      _context.Products.Attach(product);     _context.Entry(product).Property(x => x.Name).IsModified = true;      try     {         _ = await _context.SaveChangesAsync();     }     catch (DbUpdateConcurrencyException)     {         \/\/ exception is throws when @@ROWCOUNT is equal to 0         \/\/ which means no entity with such Id was updated         throw new ProductNotFoundException();     } }<\/code><\/pre>\n<h2>\u041f\u0440\u0435-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f LINQ \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 SQL<\/h2>\n<p>\u0412\u0430\u0436\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u044b EF \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 LINQ \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0438\u0448\u0435\u0442 C# \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0432 SQL \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0446\u0435\u043b\u044c \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 LINQ \u0432 SQL \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 EF \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u0435-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 LINQ \u043a\u043e\u0434\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0434\u0435\u043b\u0435\u0433\u0430\u0442, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0441\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 <code>EF.CompileQuery<\/code>\/<code>EF.CompileAsyncQuery<\/code> \u0432\u0430\u0448 LINQ \u043a\u043e\u0434, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u0430\u0448\u0438\u043c LINQ \u043a\u043e\u0434\u043e\u043c, \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u0435\u043b\u0435\u0433\u0430\u0442 \u0442\u0438\u043f\u0430 <code>Func&lt;TDbContext, TParameter1, ..., TResult><\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c, \u043d\u0435 \u0442\u0440\u0430\u0442\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0430 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044e LINQ \u0432 SQL.<\/p>\n<pre><code class=\"cs\">private readonly AdventureWorksContext _context; ... private static Func&lt;AdventureWorksContext, int, CancellationToken, Task&lt;Product>> _getProductByIdQuery =     EF.CompileAsyncQuery&lt;AdventureWorksContext, int, Product>((ctx, productId, ct) =>         ctx.Products.AsQueryable().FirstOrDefault(x => x.ProductId == productId)); ... public async Task&lt;Product> GetProduct(int productId, CancellationToken cancellationToken = default) {     return await _getProductByIdQuery.Invoke(_context, productId, cancellationToken); }<\/code><\/pre>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CPU, \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043a\u043e\u0434 \u0441\u0442\u0430\u043b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u0435\u0435 \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0447\u0435\u043c \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <code>AsNoTracking<\/code>, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u0435\u0442\u043e\u0434\u0430 <code>EF.CompileAsyncQuery<\/code>. \u0421 \u0438\u043c\u0435\u044e\u0449\u0435\u0439\u0441\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043f\u043e <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/performance\/advanced-performance-topics#compiled-queries\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<h2>\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p><code>DbContext<\/code> \u0432 Entity Framework Core, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f Framework, \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u0414\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432 EF \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u0432 \u043f\u0440\u043e\u0434\u0435, \u0432\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <code>DbContext<\/code> \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u0430\u043a \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c ? \u0412\u0441\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u0438\u0441\u043a\u043e\u043c\u0444\u043e\u0440\u0442 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438 \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u0442 \u043f\u043e\u0434 \u0443\u0433\u0440\u043e\u0437\u0443 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c EF. \u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>DbContext<\/code> \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f, \u043e \u0447\u0435\u043c \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a EF:<\/p>\n<blockquote>\n<p><strong>WARNING<\/strong>: Only disable thread safety checks after thoroughly testing that your application doesn&#8217;t contain such concurrency bugs.<\/p>\n<\/blockquote>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f EF \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 <code>DbContext<\/code> \u0435\u0441\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <code>AddDbContext<\/code>:<\/p>\n<pre><code class=\"cs\">public static void AddEfCore(this IServiceCollection services, IConfiguration config) {     services.AddDbContextPool&lt;AdventureWorksContext>(         dbContextConfig =>         {             ...             dbContextConfig.EnableThreadSafetyChecks(enableChecks: false);         });     ... }<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435, \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e BenchmarkDotNet, \u043e\u0434\u043d\u0430\u043a\u043e \u0438\u0437 \u0432\u0441\u0435\u0445 \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0446\u0438\u0444\u0440\u0443 \u0432 <strong>5<\/strong> \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 <a href=\"https:\/\/github.com\/dotnet\/efcore\/pull\/24125#issuecomment-777780033\" rel=\"noopener noreferrer nofollow\">\u043e\u0434\u043d\u043e\u0439 \u0438\u0437 issue \u043d\u0430 Github<\/a>, \u043c\u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043b\u0438 \u044d\u0442\u0443 \u043e\u043f\u0446\u0438\u044e \u0432 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u0445 &#8212; \u0440\u0435\u0448\u0430\u0442\u044c \u0432\u0430\u043c.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">Scenario name<\/p>\n<\/td>\n<td data-colwidth=\"138\" width=\"138\">\n<p align=\"left\">EF Default (ms)<\/p>\n<\/td>\n<td>\n<p align=\"left\">EF Disable concurrency check (ms)<\/p>\n<\/td>\n<td>\n<p align=\"left\">EF Context Pooling (ms)<\/p>\n<\/td>\n<td>\n<p align=\"left\">EF Context Pooling and Disable concurrency check (ms)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Create<\/p>\n<\/td>\n<td data-colwidth=\"138\" width=\"138\">\n<p align=\"left\">2,015.9<\/p>\n<\/td>\n<td>\n<p align=\"left\">2,031.8<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,867.9<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,876.7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Edit<\/p>\n<\/td>\n<td data-colwidth=\"138\" width=\"138\">\n<p align=\"left\">2,404.7<\/p>\n<\/td>\n<td>\n<p align=\"left\">2,400.6<\/p>\n<\/td>\n<td>\n<p align=\"left\">2,245.6<\/p>\n<\/td>\n<td>\n<p align=\"left\">2,258.2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Get by Id<\/p>\n<\/td>\n<td data-colwidth=\"138\" width=\"138\">\n<p align=\"left\">1,067.5<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,055.8<\/p>\n<\/td>\n<td>\n<p align=\"left\">859.2<\/p>\n<\/td>\n<td>\n<p align=\"left\">886.6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Get by Id full<\/p>\n<\/td>\n<td data-colwidth=\"138\" width=\"138\">\n<p align=\"left\">1,186.6<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,246.2<\/p>\n<\/td>\n<td>\n<p align=\"left\">984.8<\/p>\n<\/td>\n<td>\n<p align=\"left\">973.0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Get page<\/p>\n<\/td>\n<td data-colwidth=\"138\" width=\"138\">\n<p align=\"left\">8,752<\/p>\n<\/td>\n<td>\n<p align=\"left\">8,426<\/p>\n<\/td>\n<td>\n<p align=\"left\">8,105<\/p>\n<\/td>\n<td>\n<p align=\"left\">8,102<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Get page full<\/p>\n<\/td>\n<td data-colwidth=\"138\" width=\"138\">\n<p align=\"left\">3,413<\/p>\n<\/td>\n<td>\n<p align=\"left\">3,429<\/p>\n<\/td>\n<td>\n<p align=\"left\">3,368<\/p>\n<\/td>\n<td>\n<p align=\"left\">3,394<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h2>\n<p>\u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 EF \u043e\u0442 Microsoft, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043f\u0440\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438. \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043e\u0431\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>DbContext<\/code> pooling.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>AsNoTracking<\/code> \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u043f\u0440\u0435-\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c (\u043f\u043e\u043c\u043d\u044f \u043e \u0440\u0438\u0441\u043a\u0430\u0445).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0445 \u0441\u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8b0\/081\/62e\/8b008162e5b8cc923f92f3eac795d701.png\" alt=\"EF Default, EF Improved and Dapper\" title=\"EF Default, EF Improved and Dapper\" width=\"1878\" height=\"1020\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8b0\/081\/62e\/8b008162e5b8cc923f92f3eac795d701.png\"\/><figcaption>EF Default, EF Improved and Dapper<\/figcaption><\/figure>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Scenario<\/p>\n<\/td>\n<td>\n<p align=\"left\">EF Default (RPS)<\/p>\n<\/td>\n<td>\n<p align=\"left\">EF Improved (RPS)<\/p>\n<\/td>\n<td>\n<p align=\"left\">Dapper (RPS)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get product by Id<\/p>\n<\/td>\n<td>\n<p align=\"left\">7124,1<\/p>\n<\/td>\n<td>\n<p align=\"left\">8354,3<\/p>\n<\/td>\n<td>\n<p align=\"left\">8478,0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get detailed product by Id<\/p>\n<\/td>\n<td>\n<p align=\"left\">6180,5<\/p>\n<\/td>\n<td>\n<p align=\"left\">7297,5<\/p>\n<\/td>\n<td>\n<p align=\"left\">7439,9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get products page<\/p>\n<\/td>\n<td>\n<p align=\"left\">3320,7<\/p>\n<\/td>\n<td>\n<p align=\"left\">4165,5<\/p>\n<\/td>\n<td>\n<p align=\"left\">4341,2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Get detailed products page<\/p>\n<\/td>\n<td>\n<p align=\"left\">1174,8<\/p>\n<\/td>\n<td>\n<p align=\"left\">1306,2<\/p>\n<\/td>\n<td>\n<p align=\"left\">954,8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Create product<\/p>\n<\/td>\n<td>\n<p align=\"left\">2146,2<\/p>\n<\/td>\n<td>\n<p align=\"left\">2279,1<\/p>\n<\/td>\n<td>\n<p align=\"left\">3967,9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"230\" width=\"230\">\n<p align=\"left\">Edit product<\/p>\n<\/td>\n<td>\n<p align=\"left\">1859,8<\/p>\n<\/td>\n<td>\n<p align=\"left\">2472,0<\/p>\n<\/td>\n<td>\n<p align=\"left\">4371,7<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0447\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f EF \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u0438 \u043d\u0430 <strong>6-25<\/strong> \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 EF &#171;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&#187;. \u0422\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0440\u0430\u0437\u0440\u044b\u0432 \u0441 Dapper \u0438 \u0442\u0435\u043f\u0435\u0440\u044c Dapper \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442 EF \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043d\u0430 <strong>1.5-4.2<\/strong> \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0445\u043e\u0436\u0443\u044e \u0441 Dapper \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0441 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u044e C# \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u043e\u0442 SQL \u043a\u043e\u0434\u0430, \u0443\u0432\u044b \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442. Dapper \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442 EF \u043d\u0430 <strong>76<\/strong> \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043d\u0430 <strong>74<\/strong> \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e EF \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0438\u0441\u0430\u0442\u044c SQL \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>DbContext.Database.ExecuteSqlRaw<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043a\u0440\u043e\u043c\u0435 EF. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c EF <code>ExecuteSqlRaw<\/code> \u043f\u043e\u0447\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 \u043a\u043e\u0434\u0443, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 \u043d\u0430 Dapper \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432:<\/p>\n<pre><code class=\"cs\">public async Task EditProductName(int productId, string productName) {     var rowsAffected = await _context.Database.ExecuteSqlRawAsync(@\"UPDATE [Production].[Product]         SET [Name] = {0}         WHERE [ProductID] = {1}         SELECT @@ROWCOUNT\", productName, productId);     ... }<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">Benchmark name<\/p>\n<\/td>\n<td>\n<p align=\"left\">Mean (ms)<\/p>\n<\/td>\n<td>\n<p align=\"left\">Allocated (MB)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Edit_Default<\/p>\n<\/td>\n<td>\n<p align=\"left\">2,404.7<\/p>\n<\/td>\n<td>\n<p align=\"left\">70<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Edit_CombinedImprovements<\/p>\n<\/td>\n<td>\n<p align=\"left\">1,780.5<\/p>\n<\/td>\n<td>\n<p align=\"left\">21<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Edit_ContextPoolingRawSqlUpdate<\/p>\n<\/td>\n<td>\n<p align=\"left\">940.6<\/p>\n<\/td>\n<td>\n<p align=\"left\">4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Edit_Dapper<\/p>\n<\/td>\n<td>\n<p align=\"left\">916.6<\/p>\n<\/td>\n<td>\n<p align=\"left\">3<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<pre><code class=\"cs\">public async Task&lt;int> CreateProduct(Product product) {     var productId = await _context.Database.ExecuteSqlRawAsync(@\"INSERT INTO [Production].[Product]         (Name, ProductNumber, SafetyStockLevel, ReorderPoint, StandardCost, ListPrice, Class, Style, Color, SellStartDate, DaysToManufacture)     VALUES         ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10})     SELECT CAST(SCOPE_IDENTITY() as int)\",     product.Name, product.ProductNumber, product.SafetyStockLevel, product.ReorderPoint, product.StandardCost, product.ListPrice,      product.Class, product.Style, product.Color, product.SellStartDate, product.DaysToManufacture);     return productId; }<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">Benchmark name<\/p>\n<\/td>\n<td>\n<p align=\"left\">Mean (ms)<\/p>\n<\/td>\n<td>\n<p align=\"left\">Allocated (MB)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Create_Default<\/p>\n<\/td>\n<td>\n<p align=\"left\">2,015.9<\/p>\n<\/td>\n<td>\n<p align=\"left\">77<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Create_ContextPoolingRawSql<\/p>\n<\/td>\n<td>\n<p align=\"left\">947.9<\/p>\n<\/td>\n<td>\n<p align=\"left\">9<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Create_Dapper<\/p>\n<\/td>\n<td>\n<p align=\"left\">941.3<\/p>\n<\/td>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e \u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/what-is-new\/ef-core-7.0\/plan#performance-of-database-inserts-and-updates\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0440\u043e\u0436\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0435<\/a> \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 EF \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e change-tracking \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 Insert \u0438 Update:<\/p>\n<blockquote>\n<p>For EF7, we plan to focus on performance related to database inserts and updates. This includes performance of change-tracking queries, performance of <code>DetectChanges<\/code>, and performance of the insert and update commands sent to the database.<\/p>\n<\/blockquote>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0445\u043e\u0434\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/dotnet\/efcore\/issues\/26797\" rel=\"noopener noreferrer nofollow\">Github<\/a> \u0438 \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0440\u0435\u043b\u0438\u0437\u043e\u043c \u0440\u0430\u0437\u0440\u044b\u0432 \u0441 Dapper \u0432 \u044d\u0442\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d.<\/p>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>\u041a\u0430\u043a \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, EF Core \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u044e\u043b\u044f 2022 \u0433\u043e\u0434\u0430 \u043f\u0440\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u044b\u0435 \u0441 Dapper \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0441\u0432\u043e\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e SQL \u043a\u043e\u0434\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 LINQ \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e EF \u0432\u0441\u0435 \u0435\u0449\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 Dapper \u0432 Insert \u0438 Update \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 C# \u043e\u0431\u044c\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 raw sql \u043f\u043e\u0434\u0445\u043e\u0434\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u043c\u0435\u0436\u0434\u0443 EF \u0438 Dapper \u0432 \u044d\u0442\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0443\u0436\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0435. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0438 \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430, EF Core \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0431\u043e\u0433\u0430\u0442\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e \u0447\u0442\u043e EF Core \u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 NET \u043d\u0435 \u0441\u0442\u043e\u044f\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0438 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0440\u0435\u043b\u0438\u0437\u043e\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0432\u044b \u043d\u0435 \u043e\u0448\u0438\u0431\u0435\u0442\u0435\u0441\u044c \u0432\u044b\u0431\u0440\u0430\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 EF Core. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u0430.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 !<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/675310\/\"> https:\/\/habr.com\/ru\/articles\/675310\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Entity Framework Core \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0438 \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 ASP NET Core. \u042d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u043d\u043e, \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u044b\u0442\u043e\u0432\u0430\u043b\u043e \u043c\u043d\u0435\u043d\u0438\u0435 (\u0438 \u043d\u0435 \u0431\u0435\u0437\u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u0447\u0442\u043e Entity Framework \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Dapper. \u041d\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0434\u0435\u0442 \u0438 Entity Framework \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u043e\u043c\u0438\u043c\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0430\u043c\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b .NET, Entity Framework Core \u0434\u043b\u044f NET 6 \u0438\u043c\u0435\u0435\u0442 \u0440\u044f\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c Entity Framework Core \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0435\u0433\u043e \u0441 Dapper \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u044e\u043b\u044f 2022 \u0433\u043e\u0434\u0430. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f &#171;\u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0438\u0442\u0435 \u0432\u0441\u0435 \u043d\u0430 Dapper&#187; \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \ud83d\ude42<\/p>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 Entity Framework Core \u0432 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0434\u043b\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u043d\u0430\u043d\u0438\u0439 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 Entity Framework Core. <\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 EF<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u0435\u043c \u0432 \u0442\u0435\u043c\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 EF \u0438 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u043c \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0418\u0442\u0430\u043a, EF \u044d\u0442\u043e object-relational mapper (ORM) \u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 \u043a\u043e\u0434\u0435 (C# \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430) \u0441 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (\u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0441\u0442\u043e\u043b\u0431\u0435\u0446, \u0437\u0430\u043f\u0438\u0441\u044c, \u0441\u0432\u044f\u0437\u0438 etc). \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 EF \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u043e\u0442 <code>DbContext<\/code>. \u041a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043d\u0430\u0431\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432-\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439 <code>DbSet<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u044d\u0442\u0438\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 SQL \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>ToArray<\/code>, <code>ToList<\/code>, <code>FirstOrDefault<\/code> \u0438 \u0442.\u0434., \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 C# \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. <\/p>\n<pre><code class=\"cs\">public class AdventureWorksContext : DbContext {     public virtual DbSet&lt;Product> Products { get; set; }     ... } ... public void ApplicationLogic() {     using var context = new AdventureWorksContext();     \/\/ get list of products with filter     var bookProducts = context.Products.Where(p => p.Type == \"Book\").ToList();     \/\/ get single product by name     var singleBook = context.Products.Where(p => p.Name == \"Harry Potter\").FirstOrDefault();     \/\/ do data handling     ... }<\/code><\/pre>\n<p>\u0422\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, EF \u0434\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, EF \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0445 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0445 \u043e\u0442 SQL \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 C# \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 MSSQL, Oracle \u0438 MySQL. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQL \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, EF \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (change-tracking) \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c Update \u0438 Delete \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043a\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0431\u043e SQL \u043a\u043e\u0434\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<pre><code class=\"cs\">public void ApplicationLogic() {     using var context = new AdventureWorksContext();     var bookProduct = context.Products.Where(p => p.Name == \"Harry Potter\").Single();     bookProduct.Name = \"Harry Potter and the Sorcerer's Stone\"     context.SaveChanges();     \/\/ name in DB was updated !       context.Remove(bookProduct);     context.SaveChanges();     \/\/ book was deleted from DB !     ... }<\/code><\/pre>\n<p>EF \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u0433\u0430\u0442\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u0446\u0435\u043d\u0443 \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u044b EF \u043e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <code>DbContext<\/code>. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>DbContext<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 SQL. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IQueryable<\/code>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f LINQ \u043d\u0430 <code>DbSet<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c. \u041e\u0431\u044a\u0435\u043a\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 builder-\u0430: \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Where<\/code>, <code>OrderBy<\/code>, <code>Select<\/code> \u0438 \u0442.\u0434. \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u043e\u0432\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 SQL. <code>IQueryable<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <code>IEnumerable<\/code>, \u043d\u043e \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0432\u044b \u043d\u0435 \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b <code>IEnumerable<\/code> (\u0438\u043b\u0438 <code>IAsyncEnumerable<\/code>) \u044f\u0432\u043d\u043e &#8212; SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0431\u0430\u0437\u0443. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043d\u0430 <code>IQueryable<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u0430, \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043a <code>IEnumerable<\/code> (\u0438\u043b\u0438 <code>IAsyncEnumerable<\/code>), \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u0430\u043a <code>ToArray<\/code>, <code>ToList<\/code>, <code>FirstOrDefault<\/code> \u0438 \u0442.\u0434. \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438. EF \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>IQueryable<\/code> \u0432 SQL, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043a\u044d\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043d\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 (server-side calculations).<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 C# \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 (change-tracking). \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, EF \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>SaveChanges<\/code> \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 Update \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u043d\u0435\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0442\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (client-side calculations). \u041f\u043e\u043b\u0443\u0447\u0430\u044f LINQ \u0437\u0430\u043f\u0440\u043e\u0441 EF \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 SQL \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (server-side calculation). \u041d\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 SQL \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0412 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 EF Core \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043c\u043e\u0433 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u043c \u0447\u0442\u043e EF \u043d\u0435 \u0441\u043c\u043e\u0433 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 SQL \u0438 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043d\u0435\u044f\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u043b\u043e\u0433\u043e\u0432, \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0432 \u0432\u044b\u0431\u0440\u043e\u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445, \u043f\u0440\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c LINQ \u0432 SQL EF \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0442\u0440\u0435\u0431\u0443\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>AsEnumerable<\/code>, <code>ToList<\/code> \u0438 \u0442.\u0434. \u043f\u0435\u0440\u0435\u0434 \u0447\u0430\u0441\u0442\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 C# (client-side calculations). \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/querying\/client-eval\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 Microsoft<\/a>. \u0412 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0431\u043b\u043e\u043a\u0435 <code>Where<\/code>, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 SQL \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c <code>DbContext<\/code>, \u0432\u044b\u0437\u043e\u0432\u043e\u043c ADO NET \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445, \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u044f GC, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0438 \u043e\u0447\u0438\u0449\u0430\u044e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043a\u044d\u0448\u0438 \u0438 \u0442.\u0434. Dapper \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 ADO NET \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u043b\u0438\u0448\u0435\u043d\u043d\u0443\u044e \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 EF, \u043d\u043e \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Dapper:<\/p>\n<pre><code class=\"cs\">public void ApplicationLogic() {     using var sqlConnection = new SqlConnection(connectionString);     var product = connection.QuerySingleOrDefault&lt;Product>(@\"         select * from Products          where Name = @name     \", new { name = \"Harry Potter\" }); }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 EF \u0438 \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043e\u0431\u0437\u043e\u0440\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c.<\/p>\n<h2>System Under Test (SUT)<\/h2>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0435\u0431 API, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 SQL \u0431\u0430\u0437\u043e\u0439 AdventureWorks, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432:<\/p>\n<ul>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e Id \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. <em>Get product by Id<\/em>;<\/p>\n<\/li>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e Id \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 (JOIN-s). <em>Get product with model and product category by id<\/em>;<\/p>\n<\/li>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. <em>Get products page<\/em>;<\/p>\n<\/li>\n<li>\n<p>GET \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 (JOIN-s). <em>Get products page with model and product category datas<\/em>;<\/p>\n<\/li>\n<li>\n<p>POST \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435. <em>Create product<\/em><\/p>\n<\/li>\n<li>\n<p>PUT \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. <em>Edit product name<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c API \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <code>IProductsRepository<\/code> \u043d\u0430 \u0431\u0430\u0437\u0435 EF \u0438\u043b\u0438 Dapper \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c NBomber \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e NBomber \u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/664824\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/MrPomidor\/EFCorePerformanceTipsDemo\/tree\/master\/src\/Solution\/Tests\/Benchmarks\" rel=\"noopener noreferrer nofollow\">BenchmarkDotNet \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043d\u0430\u0448\u0435 API \u0432 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IProductsRepository<\/code> \u0434\u043b\u044f EF, Dapper \u0438 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 EF \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"cs\">private ServiceProvider EFCoreDefaultImplementationServiceProvider; ... [GlobalSetup] public void GlobalSetup() {     BuildDefaultImplementationServiceProvider(); } ... [Benchmark] public async Task GetProduct_Benchmark() {     \/\/ we will do several iterations, emulating several requests, to see difference in time and memory better     for (int i = 0; i &lt; IterationsCount; i++)     {         \/\/ as for each HTTP request in web api, we will create DI scope         using var scope = EFCoreDefaultImplementationServiceProvider.CreateScope();         \/\/ ... from which we will resolve implementation under test          var repository = scope.ServiceProvider.GetRequiredService&lt;IProductsRepository>();         \/\/ get product by id scenario as example         var product = await repository.GetProduct(ProductIds[i % (ProductIds.Length - 1)]);     } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u0435 <a href=\"https:\/\/docs.microsoft.com\/en-us\/ef\/core\/performance\/advanced-performance-topics\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438<\/a> \u043f\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b EF, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d NBomber \u0442\u0435\u0441\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/MrPomidor\/EFCorePerformanceTipsDemo\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 Github<\/a>.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-388423","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/388423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=388423"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/388423\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=388423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=388423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=388423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}