{"id":291989,"date":"2019-07-12T09:02:45","date_gmt":"2019-07-12T09:02:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291989"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291989","title":{"rendered":"\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 LINQ-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 C#.NET \u0434\u043b\u044f MS SQL Server"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">LINQ \u0432\u043e\u0448\u0435\u043b \u0432 .NET \u043a\u0430\u043a \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0449\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. LINQ to SQL \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0421\u0423\u0411\u0414 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Entity Framework. \u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044f \u0435\u0433\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c queryable provider, \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 Entity Framework.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 SQL Server \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 Test, \u0430 \u0432 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">USE [TEST] GO  SET ANSI_NULLS ON GO  SET QUOTED_IDENTIFIER ON GO  CREATE TABLE [dbo].[Ref]( \t[ID] [int] NOT NULL, \t[ID2] [int] NOT NULL, \t[Name] [nvarchar](255) NOT NULL, \t[InsertUTCDate] [datetime] NOT NULL,  CONSTRAINT [PK_Ref] PRIMARY KEY CLUSTERED  ( \t[ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO  ALTER TABLE [dbo].[Ref] ADD  CONSTRAINT [DF_Ref_InsertUTCDate]  DEFAULT (getutcdate()) FOR [InsertUTCDate] GO  USE [TEST] GO  SET ANSI_NULLS ON GO  SET QUOTED_IDENTIFIER ON GO  CREATE TABLE [dbo].[Customer]( \t[ID] [int] NOT NULL, \t[Name] [nvarchar](255) NOT NULL, \t[Ref_ID] [int] NOT NULL, \t[InsertUTCDate] [datetime] NOT NULL, \t[Ref_ID2] [int] NOT NULL,  CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED  ( \t[ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO  ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_Ref_ID]  DEFAULT ((0)) FOR [Ref_ID] GO  ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_InsertUTCDate]  DEFAULT (getutcdate()) FOR [InsertUTCDate] GO <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Ref \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Ref<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">USE [TEST] GO  DECLARE @ind INT=1;  WHILE(@ind&lt;1200000) BEGIN \tINSERT INTO [dbo].[Ref]            ([ID]            ,[ID2]            ,[Name])     SELECT            @ind            ,@ind            ,CAST(@ind AS NVARCHAR(255));  \tSET @ind=@ind+1; END  GO <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Customer \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Customer<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">USE [TEST] GO  DECLARE @ind INT=1; DECLARE @ind_ref INT=1;  WHILE(@ind&lt;=12000000) BEGIN \tIF(@ind%3=0) SET @ind_ref=1; \tELSE IF (@ind%5=0) SET @ind_ref=2; \tELSE IF (@ind%7=0) SET @ind_ref=3; \tELSE IF (@ind%11=0) SET @ind_ref=4; \tELSE IF (@ind%13=0) SET @ind_ref=5; \tELSE IF (@ind%17=0) SET @ind_ref=6; \tELSE IF (@ind%19=0) SET @ind_ref=7; \tELSE IF (@ind%23=0) SET @ind_ref=8; \tELSE IF (@ind%29=0) SET @ind_ref=9; \tELSE IF (@ind%31=0) SET @ind_ref=10; \tELSE IF (@ind%37=0) SET @ind_ref=11; \tELSE SET @ind_ref=@ind%1190000; \t \tINSERT INTO [dbo].[Customer] \t           ([ID] \t           ,[Name] \t           ,[Ref_ID] \t           ,[Ref_ID2]) \t     SELECT \t           @ind, \t           CAST(@ind AS NVARCHAR(255)), \t           @ind_ref, \t           @ind_ref;   \tSET @ind=@ind+1; END GO <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u043e\u043b\u0435\u0435 1 \u043c\u043b\u043d \u0441\u0442\u0440\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439-\u0431\u043e\u043b\u0435\u0435 10 \u043c\u043b\u043d \u0441\u0442\u0440\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 Visual Studio \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 Visual C# Console App (.NET Framework):<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_8\/on\/cg\/_8oncgmu5_8_pztudwbuvb_sno4.jpeg\" alt=\"image\"><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f Entity Framework. <br \/>  \u0427\u0442\u043e\u0431\u044b \u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u043d\u0430\u0436\u043c\u0435\u043c \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u0438 \u0438 \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u043c \u043c\u0435\u043d\u044e Manage NuGet Packages:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nx\/7h\/ro\/nx7hromcmjrxgcmucgyrsqoal3g.jpeg\" alt=\"image\"><\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f NuGet-\u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u0432 \u043e\u043a\u043d\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432\u0432\u0435\u0434\u0435\u043c \u0441\u043b\u043e\u0432\u043e \u00abEntity Framework\u00bb \u0438 \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043f\u0430\u043a\u0435\u0442 Entity Framework \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0433\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tc\/jw\/yp\/tcjwypggqb64ah4bmf7xjosbgz4.jpeg\" alt=\"image\"><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 App.config \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 configSections \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a:<\/p>\n<pre><code class=\"xml\">&lt;connectionStrings&gt;     &lt;add name=\"DBConnection\" connectionString=\"data source=\u0418\u041c\u042f_\u042d\u041a\u0417\u0415\u041c\u041f\u041b\u042f\u0420\u0410_MSSQL;Initial Catalog=TEST;Integrated Security=True;\" providerName=\"System.Data.SqlClient\" \/&gt; &lt;\/connectionStrings&gt; <\/code><\/pre>\n<p>  \u0412 connectionString \u043d\u0443\u0436\u043d\u043e \u0432\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 3 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<ol>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IBaseEntityID<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">namespace TestLINQ {     public interface IBaseEntityID     {         int ID { get; set; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IBaseEntityName<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">namespace TestLINQ {     public interface IBaseEntityName     {         string Name { get; set; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IBaseNameInsertUTCDate<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">namespace TestLINQ {     public interface IBaseNameInsertUTCDate     {         DateTime InsertUTCDate { get; set; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>  \u0418 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 BaseEntity \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0439\u0434\u0443\u0442 \u043e\u0431\u0449\u0438\u0435 \u043f\u043e\u043b\u044f:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 BaseEntity<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">namespace TestLINQ {     public class BaseEntity : IBaseEntityID, IBaseEntityName, IBaseNameInsertUTCDate     {         public int ID { get; set; }         public string Name { get; set; }         public DateTime InsertUTCDate { get; set; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448\u0438 \u0434\u0432\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 Ref<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System.ComponentModel.DataAnnotations.Schema;  namespace TestLINQ {     [Table(\"Ref\")]     public class Ref : BaseEntity     {         public int ID2 { get; set; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 Customer<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System.ComponentModel.DataAnnotations.Schema;  namespace TestLINQ {     [Table(\"Customer\")]     public class Customer: BaseEntity     {         public int Ref_ID { get; set; }         public int Ref_ID2 { get; set; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 UserContext:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 UserContex<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System.Data.Entity;  namespace TestLINQ {     public class UserContext : DbContext     {         public UserContext()             : base(\"DbConnection\")         {             Database.SetInitializer&lt;UserContext&gt;(null);         }          public DbSet&lt;Customer&gt; Customer { get; set; }         public DbSet&lt;Ref&gt; Ref { get; set; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 LINQ to SQL \u0447\u0435\u0440\u0435\u0437 EF \u0434\u043b\u044f MS SQL Server:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d5\/ub\/me\/d5ubmeu5flbvj0c7zjqlongrm1c.jpeg\" alt=\"image\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u0444\u0430\u0439\u043b Program.cs \u0432\u0432\u0435\u0434\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0424\u0430\u0439\u043b Program.cs<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Collections.Generic; using System.Linq;  namespace TestLINQ {     class Program     {         static void Main(string[] args)         {             using (UserContext db = new UserContext())             {                 var dblog = new List&lt;string&gt;();                 db.Database.Log = dblog.Add;                  var query = from e1 in db.Customer                             from e2 in db.Ref                             where (e1.Ref_ID == e2.ID)                                  &amp;&amp; (e1.Ref_ID2 == e2.ID2)                             select new { Data1 = e1.Name, Data2 = e2.Name };                  var result = query.Take(1000).ToList();                  Console.WriteLine(dblog[1]);                  Console.ReadKey();             }         }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL-\u0437\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT TOP (1000)      [Extent1].[Ref_ID] AS [Ref_ID],      [Extent1].[Name] AS [Name],      [Extent2].[Name] AS [Name1]     FROM  [dbo].[Customer] AS [Extent1]     INNER JOIN [dbo].[Ref] AS [Extent2] ON ([Extent1].[Ref_ID] = [Extent2].[ID]) AND ([Extent1].[Ref_ID2] = [Extent2].[ID2]) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422. \u0435. \u0432 \u0446\u0435\u043b\u043e\u043c \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e LINQ-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b SQL-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0421\u0423\u0411\u0414 MS SQL Server.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0418 \u043d\u0430 \u0418\u041b\u0418 \u0432 LINQ-\u0437\u0430\u043f\u0440\u043e\u0441\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">LINQ-\u0437\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">var query = from e1 in db.Customer                             from e2 in db.Ref                             where (e1.Ref_ID == e2.ID)                                 || (e1.Ref_ID2 == e2.ID2)                             select new { Data1 = e1.Name, Data2 = e2.Name }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0432\u043d\u043e\u0432\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u043b\u0435\u0442\u0438\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0441 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 30 \u0441\u0435\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nm\/2q\/zb\/nm2qzbaazpt5nemnisu4ubatvfy.jpeg\" alt=\"image\"><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u044b\u043b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d LINQ:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hp\/jf\/if\/hpjfif-gzr9ncr7dxdspvrxxmuw.jpeg\" alt=\"image\"><br \/>  , \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 (\u0442\u0430\u0431\u043b\u0438\u0446):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL-\u0437\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT TOP (1000)      [Extent1].[Ref_ID] AS [Ref_ID],      [Extent1].[Name] AS [Name],      [Extent2].[Name] AS [Name1]     FROM  [dbo].[Customer] AS [Extent1]     CROSS JOIN [dbo].[Ref] AS [Extent2]     WHERE [Extent1].[Ref_ID] = [Extent2].[ID] OR [Extent1].[Ref_ID2] = [Extent2].[ID2] <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c LINQ-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 LINQ-\u0437\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">var query = (from e1 in db.Customer                    join e2 in db.Ref                    on e1.Ref_ID equals e2.ID                    select new { Data1 = e1.Name, Data2 = e2.Name }).Union(                         from e1 in db.Customer                         join e2 in db.Ref                         on e1.Ref_ID2 equals e2.ID2                         select new { Data1 = e1.Name, Data2 = e2.Name }); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 SQL-\u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">SQL-\u0437\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT      [Limit1].[C1] AS [C1],      [Limit1].[C2] AS [C2],      [Limit1].[C3] AS [C3]     FROM ( SELECT DISTINCT TOP (1000)          [UnionAll1].[C1] AS [C1],          [UnionAll1].[Name] AS [C2],          [UnionAll1].[Name1] AS [C3]         FROM  (SELECT              1 AS [C1],              [Extent1].[Name] AS [Name],              [Extent2].[Name] AS [Name1]             FROM  [dbo].[Customer] AS [Extent1]             INNER JOIN [dbo].[Ref] AS [Extent2] ON [Extent1].[Ref_ID] = [Extent2].[ID]         UNION ALL             SELECT              1 AS [C1],              [Extent3].[Name] AS [Name],              [Extent4].[Name] AS [Name1]             FROM  [dbo].[Customer] AS [Extent3]             INNER JOIN [dbo].[Ref] AS [Extent4] ON [Extent3].[Ref_ID2] = [Extent4].[ID2]) AS [UnionAll1]     )  AS [Limit1] <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0423\u0432\u044b, \u043d\u043e \u0432 LINQ-\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 Union \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0441\u0440\u0435\u0434\u0438 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u043b\u0430\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u044d\u0442\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432:<\/p>\n<ol>\n<li>\u0434\u043b\u044f CROSS JOIN \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 195 \u0441\u0435\u043a:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oi\/mu\/a9\/oimua9m82rdxniskq4foxwrvkwc.jpeg\" alt=\"image\"><\/li>\n<li>\u0434\u043b\u044f INNER JOIN-UNION \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u0435\u0435 1 \u0441\u0435\u043a:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mh\/hf\/cz\/mhhfczpf2esap2nlk4njcdtvzss.jpeg\"><\/li>\n<\/ol>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 LINQ-\u0437\u0430\u043f\u0440\u043e\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 195 \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439.<\/p>\n<p>  \u0414\u043b\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0441 \u0418 \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 LINQ-\u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0438\u0434\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">LINQ-\u0437\u0430\u043f\u0440\u043e\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">var query = from e1 in db.Customer                             from e2 in db.Ref                             where (e1.Ref_ID == e2.ID)                                  &amp;&amp; (e1.Ref_ID2 == e2.ID2)                             select new { Data1 = e1.Name, Data2 = e2.Name }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 SQL-\u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 1 \u0441\u0435\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/og\/pw\/bb\/ogpwbbxpwnrbglhijd74-ekdnu4.jpeg\" alt=\"image\"><br \/>  \u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 LINQ to Objects \u0432\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u0438\u0434\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">LINQ-\u0437\u0430\u043f\u0440\u043e\u0441 (1-\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">var query = from e1 in seq1                             from e2 in seq2                             where (e1.Key1==e2.Key1)                                &amp;&amp; (e1.Key2==e2.Key2)                             select new { Data1 = e1.Data, Data2 = e2.Data }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0438\u0434\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">LINQ-\u0437\u0430\u043f\u0440\u043e\u0441 (2-\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">var query = from e1 in seq1                             join e2 in seq2                             on new { e1.Key1, e1.Key2 } equals new { e2.Key1, e2.Key2 }                             select new { Data1 = e1.Data, Data2 = e2.Data }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0433\u0434\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">Para[] seq1 = new[] { new Para { Key1 = 1, Key2 = 2, Data = \"777\" }, new Para { Key1 = 2, Key2 = 3, Data = \"888\" }, new Para { Key1 = 3, Key2 = 4, Data = \"999\" } }; Para[] seq2 = new[] { new Para { Key1 = 1, Key2 = 2, Data = \"777\" }, new Para { Key1 = 2, Key2 = 3, Data = \"888\" }, new Para { Key1 = 3, Key2 = 5, Data = \"999\" } }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  , \u0430 \u0442\u0438\u043f Para \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 Para<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">class Para {         public int Key1, Key2;         public string Data; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 LINQ-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a MS SQL Server.<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0434\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0438 \u0432\u0435\u0434\u0443\u0449\u0438\u0435 .NET-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442. \u0418\u043d\u0430\u0447\u0435 \u043e\u043d\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u043b\u043e\u0436\u0438\u0442\u044c \u0431\u043e\u043c\u0431\u0443 \u0437\u0430\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043a\u0430\u043a \u043f\u0440\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u043f\u0440\u0438 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0441\u0440\u0435\u0434\u044b.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u0437\u043e\u0440 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u0438 <a href=\"https:\/\/stackoverflow.com\/questions\/56940996\/how-to-optimally-combine-two-collections-in-linq-with-several-conditions-for-ms\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/459716\/\"> https:\/\/habr.com\/ru\/post\/459716\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">LINQ \u0432\u043e\u0448\u0435\u043b \u0432 .NET \u043a\u0430\u043a \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0449\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. LINQ to SQL \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0421\u0423\u0411\u0414 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Entity Framework. \u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044f \u0435\u0433\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c queryable provider, \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 Entity Framework.  <\/p>\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-291989","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291989","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=291989"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291989\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}