{"id":256624,"date":"2015-05-05T17:03:03","date_gmt":"2015-05-05T13:03:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=256624"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=256624","title":{"rendered":"\u041e\u0431\u0437\u043e\u0440 ServiceStack.OrmLite \u2014 micro-ORM \u0434\u043b\u044f .NET"},"content":{"rendered":"<p>     \tOrmLite \u2014 \u044d\u0442\u043e \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u0430\u044f micro-ORM \u0441 <a href=\"https:\/\/github.com\/ServiceStack\/ServiceStack.OrmLite\">\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c<\/a> \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0438 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0439 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 (<a href=\"https:\/\/servicestack.net\/download#free-quotas\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430<\/a> \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0432 10 \u0442\u0430\u0431\u043b\u0438\u0446). \u0412\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/servicestack.net\/\">ServiceStack<\/a> (\u0438 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u2014 \u0432\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/StackExchange\/dapper-dot-net#performance-of-select-mapping-over-500-iterations---poco-serialization\">benchmark<\/a> \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Dapper). \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 OrmLite \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 SQL Server. \u0415\u0441\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c OrmLite \u0438 Entity Framework, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 (change tracking). \u0418 \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f.<\/p>\n<p>  \u041f\u043b\u0430\u043d \u0441\u0442\u0430\u0442\u044c\u0438:  <\/p>\n<ul>\n<li><a href=\"#P1\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435. Code-first \u0438 database-first \u043f\u043e\u0434\u0445\u043e\u0434\u044b<\/a><\/li>\n<li><a href=\"#P2\">\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0411\u0414<\/a><\/li>\n<li><a href=\"#P3\">JOIN \u0438 navigation properties<\/a><\/li>\n<li><a href=\"#P4\">Lazy \u0438 Async<\/a><\/li>\n<li><a href=\"#P5\">\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"#P6\">\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 OrmLite \u0438 Entity Framework<\/a><\/li>\n<li><a href=\"#P7\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/li>\n<\/ul>\n<p>  \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a> <br \/>  <a name=\"P1\"><\/a><\/p>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435. Code-first \u0438 database-first \u043f\u043e\u0434\u0445\u043e\u0434\u044b<\/h3>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c OrmLite \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442:  <\/p>\n<blockquote><p> Install-Package ServiceStack.OrmLite.SqlServer  <\/p><\/blockquote>\n<p>  OrmLite \u2014 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c code-first ORM. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 POCO \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0411\u0414. \u0421 \u0442\u0430\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u0438 \u043d\u0430\u0447\u043d\u0435\u043c, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 T4 \u0448\u0430\u0431\u043b\u043e\u043d\u044b:  <\/p>\n<blockquote><p> Install-Package ServiceStack.OrmLite.T4  <\/p><\/blockquote>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e 3 \u0444\u0430\u0439\u043b\u0430:  <\/p>\n<blockquote><p> OrmLite.Core.ttinclude<br \/>   OrmLite.Poco.tt<br \/>   OrmLite.SP.tt  <\/p><\/blockquote>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0432 app\/web.config \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c ConnectionStringName \u0432 \u0444\u0430\u0439\u043b\u0435 OrmLite.Poco.tt (\u0434\u043b\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 app.config \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e), \u0436\u043c\u0435\u043c \u043d\u0430 \u0444\u0430\u0439\u043b\u0435 Run Custom Tool \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 POCO \u043a\u043b\u0430\u0441\u0441\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"cs\">\t[Alias(&quot;Order&quot;)] \t[Schema(&quot;dbo&quot;)] \tpublic partial class Order : IHasId&lt;int&gt; \t{ \t\t[AutoIncrement] \t\tpublic int Id { get; set; } \t\t[Required] \t\tpublic int Number { get; set; } \t\tpublic string Text { get; set; } \t\tpublic int? CustomerId { get; set; } \t} <\/code><\/pre>\n<p>  \u041e\u041a, \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u043e\u0442\u043e\u0432\u0430. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0411\u0414. \u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0443 OrmLite \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 OrmLiteConnection, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0433\u043e IDbConnection:<\/p>\n<pre><code class=\"cs\">    var dbFactory = new OrmLiteConnectionFactory(ConnectionString, SqlServerDialect.Provider);     using (IDbConnection db = dbFactory.Open())     {         \/\/db.AnyMethod...     } <\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u0434\u0430\u043b\u0435\u0435 \u043e\u043d \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 db. <\/p>\n<p>  \u0412\u044b\u0431\u0435\u0440\u0435\u043c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Order \u0441 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c Number, \u0431\u043e\u043b\u044c\u0448\u0438\u043c 50:  <\/p>\n<pre><code class=\"cs\">    List&lt;Order&gt; orders = db.Select&lt;Order&gt;(order =&gt; order.Number &gt; 50); <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e! <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0410 \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 OrmLiteConnection?<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u0431\u044b\u0447\u043d\u044b\u0439 <a href=\"https:\/\/msdn.microsoft.com\/ru-ru\/library\/System.Data.SqlClient.SqlConnection(v=vs.110).aspx\">SqlConnection<\/a>:  <\/p>\n<pre><code class=\"cs\">    public override IDbConnection CreateConnection(string connectionString, Dictionary&lt;string, string&gt; options)     {         var isFullConnectionString = connectionString.Contains(&quot;;&quot;);          if (!isFullConnectionString)         {             var filePath = connectionString;              var filePathWithExt = filePath.ToLower().EndsWith(&quot;.mdf&quot;)                 ? filePath                 : filePath + &quot;.mdf&quot;;              var fileName = Path.GetFileName(filePathWithExt);             var dbName = fileName.Substring(0, fileName.Length - &quot;.mdf&quot;.Length);              connectionString = string.Format(             @&quot;Data Source=.\\SQLEXPRESS;AttachDbFilename={0};Initial Catalog={1};Integrated Security=True;User Instance=True;&quot;,                 filePathWithExt, dbName);         }          if (options != null)         {             foreach (var option in options)             {                 if (option.Key.ToLower() == &quot;read only&quot;)                 {                     if (option.Value.ToLower() == &quot;true&quot;)                     {                         connectionString += &quot;Mode = Read Only;&quot;;                     }                     continue;                 }                 connectionString += option.Key + &quot;=&quot; + option.Value + &quot;;&quot;;             }         }          return new SqlConnection(connectionString);     }     <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u043e\u0434\u0445\u043e\u0434\u0443 code-first. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c DROP \u0438 CREATE \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cs\">      db.DropAndCreateTable&lt;Order&gt;(); <\/code><\/pre>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u043d\u0435\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u04224 POCO \u043a\u043b\u0430\u0441\u0441\u044b \u0443\u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u0447\u0430\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0411\u0414 (\u0434\u043b\u0438\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0438 \u0438 \u0434\u0440.). OrmLite \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u043d\u0430\u0448\u0438 POCO (code-first oriented \u0436\u0435!). \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f nvarchar(20) \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u2014 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 Number, Text, \u0438 CustomerId \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e:  <\/p>\n<pre><code class=\"cs\">    [Schema(&quot;dbo&quot;)]     public partial class Order : IHasId&lt;int&gt;     {         [AutoIncrement]         public int Id { get; set; } \t\t         [Index(NonClustered = true)]         public int Number { get; set; } \t\t         [CustomField(&quot;NVARCHAR(20)&quot;)]         public string Text { get; set; } \t\t         [ForeignKey(typeof(Customer))]         public int? CustomerId { get; set; }     } <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 db.CreateTable \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 SQL-\u0437\u0430\u043f\u0440\u043e\u0441:  <\/p>\n<pre><code class=\"sql\">    CREATE TABLE &quot;dbo&quot;.&quot;Order&quot;      (       &quot;Id&quot; INTEGER PRIMARY KEY IDENTITY(1,1),        &quot;Number&quot; INTEGER NOT NULL,        &quot;Text&quot; NVARCHAR(20) NULL,        &quot;CustomerId&quot; INTEGER NULL,        CONSTRAINT &quot;FK_dbo_Order_dbo_Customer_CustomerId&quot; FOREIGN KEY (&quot;CustomerId&quot;) REFERENCES &quot;dbo&quot;.&quot;Customer&quot; (&quot;Id&quot;)      );      CREATE  NONCLUSTERED INDEX idx_order_number ON &quot;dbo&quot;.&quot;Order&quot; (&quot;Number&quot; ASC);  <\/code><\/pre>\n<p>  <a name=\"P2\"><\/a><\/p>\n<h3>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0411\u0414<\/h3>\n<p>  \u0412 OrmLite \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b 2 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0411\u0414: \u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL. \u041d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Order c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c CustomerId \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<p>  1) \u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 SqlExpression:  <\/p>\n<pre><code class=\"cs\">    List&lt;Order&gt; orders = db.Select&lt;Order&gt;(order =&gt; order.CustomerId == customerId); <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cs\">    List&lt;Order&gt; orders = db.Select(db.From&lt;Order&gt;().Where(order =&gt; order.CustomerId == customerId)); <\/code><\/pre>\n<p>  2) \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL:  <\/p>\n<pre><code class=\"cs\">    List&lt;Order&gt; orders = db.SelectFmt&lt;Order&gt;(&quot;CustomerId = {0}&quot;, customerId); <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cs\">    List&lt;Order&gt; orders = db.SelectFmt&lt;Order&gt;(&quot;SELECT * FROM [Order] WHERE CustomerId = {0}&quot;, customerId); <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 insert\/update\/delete \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u041f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 CRUD<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">    db.Update(new Person { Id = 1, FirstName = &quot;Jimi&quot;, LastName = &quot;Hendrix&quot;, Age = 27}); <\/code><\/pre>\n<p>  SQL:  <\/p>\n<pre><code class=\"sql\">    UPDATE &quot;Person&quot; SET &quot;FirstName&quot; = 'Jimi',&quot;LastName&quot; = 'Hendrix',&quot;Age&quot; = 27 WHERE &quot;Id&quot; = 1 <\/code><\/pre>\n<pre><code class=\"cs\">    db.Insert(new Person { Id = 1, FirstName = &quot;Jimi&quot;, LastName = &quot;Hendrix&quot;, Age = 27 }); <\/code><\/pre>\n<p>  SQL:  <\/p>\n<pre><code class=\"sql\">    INSERT INTO &quot;Person&quot; (&quot;Id&quot;,&quot;FirstName&quot;,&quot;LastName&quot;,&quot;Age&quot;) VALUES (1,'Jimi','Hendrix',27) <\/code><\/pre>\n<pre><code class=\"cs\">    db.Delete&lt;Person&gt;(p =&gt; p.Age == 27); <\/code><\/pre>\n<p>  SQL:  <\/p>\n<pre><code class=\"sql\">    DELETE FROM &quot;Person&quot; WHERE (&quot;Age&quot; = 27) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438.<\/p>\n<p>  <a name=\"P3\"><\/a><\/p>\n<h3>JOIN \u0438 navigation properties<\/h3>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u0443\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043d\u0430\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0435 Order \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Customer:  <\/p>\n<pre><code class=\"cs\">    class Customer     {         [AutoIncrement]         public int Id { get; set; }         public string Name { get; set; }     } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (INNER JOIN) \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cs\">    List&lt;Order&gt; orders = db.Select&lt;Order&gt;(q =&gt; q.Join&lt;Customer&gt;()); <\/code><\/pre>\n<p>  SQL:  <\/p>\n<pre><code class=\"sql\">    SELECT &quot;Order&quot;.&quot;Id&quot;, &quot;Order&quot;.&quot;Details&quot;, &quot;Order&quot;.&quot;CustomerId&quot;      FROM &quot;Order&quot; INNER JOIN &quot;Customer&quot; ON (&quot;Customer&quot;.&quot;Id&quot; = &quot;Order&quot;.&quot;CustomerId&quot;) <\/code><\/pre>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f LEFT JOIN \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 q.LeftJoin \u0438 \u0442.\u0434. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0441\u043f\u043e\u0441\u043e\u0431 \u21161 \u2014 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 OrderInfo:  <\/p>\n<pre><code class=\"cs\">    class OrderInfo \t{ \t\tpublic int OrderId { get; set; } \t\tpublic string OrderDetails { get; set; } \t\tpublic int? CustomerId { get; set; } \t\tpublic string CustomerName { get; set; } \t} <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cs\">    List&lt;OrderInfo&gt; info = db.Select&lt;OrderInfo&gt;(db.From&lt;Order&gt;().Join&lt;Customer&gt;()); <\/code><\/pre>\n<p>  SQL:  <\/p>\n<pre><code class=\"sql\">    SELECT &quot;Order&quot;.&quot;Id&quot; as &quot;OrderId&quot;, &quot;Order&quot;.&quot;Details&quot; as &quot;OrderDetails&quot;, &quot;Order&quot;.&quot;CustomerId&quot;, &quot;Customer&quot;.&quot;Name&quot; as &quot;CustomerName&quot;      FROM &quot;Order&quot; INNER JOIN &quot;Customer&quot; ON (&quot;Customer&quot;.&quot;Id&quot; = &quot;Order&quot;.&quot;CustomerId&quot;) <\/code><\/pre>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 OrderInfo \u2014 \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 {TableName}{FieldName}.<br \/>  \u0421\u043f\u043e\u0441\u043e\u0431 \u21162 \u0432 \u0441\u0442\u0438\u043b\u0435 EF \u2014 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f navigation properties (\u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 OrmLite \u043e\u043d\u0438 \u0438\u043c\u0435\u043d\u0443\u044e\u0442\u0441\u044f \u00abreferences\u00bb).<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043b\u0430\u0441\u0441 Order \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e:  <\/p>\n<pre><code class=\"cs\">    [Reference] \tCustomer Customer { get; set; } <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u0440\u0438 \u043b\u044e\u0431\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0432\u0438\u0434\u0430 db.Select, \u0447\u0442\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u043e. \u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c db.LoadSelect:  <\/p>\n<pre><code class=\"cs\">    List&lt;Order&gt; orders = db.LoadSelect&lt;Order&gt;();     Assert.True(orders.All(order =&gt; order.Customer != null)); <\/code><\/pre>\n<p>  SQL:  <\/p>\n<pre><code class=\"sql\">    SELECT &quot;Id&quot;, &quot;Details&quot;, &quot;CustomerId&quot; FROM &quot;Order&quot;     SELECT &quot;Id&quot;, &quot;Name&quot; FROM &quot;Customer&quot; WHERE &quot;Id&quot; IN (SELECT &quot;CustomerId&quot; FROM &quot;Order&quot;) <\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 customer.Orders.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0432 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0443 {Parent}Id, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e OrmLite \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0432 \u043a\u043e\u0434. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c:  <\/p>\n<pre><code class=\"cs\">    [References(typeof(Parent))]     public int? CustomerId { get; set; } <\/code><\/pre>\n<p>  \u0438 \u044f\u0432\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cs\">    SqlExpression&lt;Order&gt; expression = db         .From&lt;Order&gt;()         .Join&lt;Order, Customer&gt;((order, customer) =&gt; order.CustomerId == customer.Id);     List&lt;Order&gt; orders = db.Select(expression); <\/code><\/pre>\n<p>  <a name=\"P4\"><\/a><\/p>\n<h3>Lazy \u0438 Async<\/h3>\n<p>  \u041e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 SELECT \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0447\u0435\u0440\u0435\u0437 IEnumerable. \u0414\u043b\u044f *Lazy-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0422\u0430\u043a SelectLazy \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0422\u041e\u041b\u042c\u041a\u041e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e SQL:  <\/p>\n<pre><code class=\"cs\">    IEnumerable&lt;Product&gt; lazyQuery = db.SelectLazy&lt;Product&gt;(&quot;UnitPrice &gt; @UnitPrice&quot;, new { UnitPrice = 10 }); <\/code><\/pre>\n<p>  \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u0445\u043e\u0434\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u044b\u0437\u043e\u0432\u0443:  <\/p>\n<pre><code class=\"cs\">    db.Select&lt;Product&gt;(q =&gt; q.UnitPrice &gt; 10); <\/code><\/pre>\n<p>  \u0414\u043b\u044f ColumnLazy (\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b) \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f SqlExpression:  <\/p>\n<pre><code class=\"cs\">    IEnumerable&lt;string&gt; lazyQuery = db.ColumnLazy&lt;string&gt;(db.From&lt;Product&gt;().Where(x =&gt; x.UnitPrice &gt; 10)); <\/code><\/pre>\n<p>  \u041d\u0435 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440 lazy queries, \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c OrmLite API \u0438\u043c\u0435\u0435\u0442 async-\u0432\u0435\u0440\u0441\u0438\u0438:  <\/p>\n<pre><code class=\"cs\">    List&lt;Employee&gt; employees = await db.SelectAsync&lt;Employee&gt;(employee =&gt; employee.City == &quot;London&quot;); <\/code><\/pre>\n<p>  <a name=\"P5\"><\/a><\/p>\n<h3>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/h3>\n<p>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"cs\">    db.DropAndCreateTable&lt;Employee&gt;();     Assert.IsTrue(db.Count&lt;Employee&gt;() == 0);     using (IDbTransaction transaction = db.OpenTransaction())     {         db.Insert(new Employee {Name = &quot;First&quot;});          transaction.Commit();     }     Assert.IsTrue(db.Count&lt;Employee&gt;() == 1);     using (IDbTransaction transaction = db.OpenTransaction())     {         db.Insert(new Employee { Name = &quot;Second&quot; });          Assert.IsTrue(db.Count&lt;Employee&gt;() == 2);          transaction.Rollback();     }     Assert.IsTrue(db.Count&lt;Employee&gt;() == 1); <\/code><\/pre>\n<p>  \u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0443 db.OpenTransaction \u2014 \u0432\u044b\u0437\u043e\u0432 <a href=\"https:\/\/msdn.microsoft.com\/ru-ru\/library\/86773566(v=vs.110).aspx\">SqlConnection.BeginTransaction<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0442\u0435\u043c\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u043c.<\/p>\n<p>  <a name=\"P6\"><\/a><\/p>\n<h3>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0441\u0442\u0440\u043e\u043a. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 OrmLite \u0438 Entity Framework<\/h3>\n<p>  \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044f\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f SELECT-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, OrmLite API \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 3 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0441\u0442\u0440\u043e\u043a \u0432 \u0411\u0414:  <\/p>\n<blockquote><p> InsertAll(IEnumerable)<br \/>   UpdateAll(IEnumerable)<br \/>   DeleteAll(IEnumerable)  <\/p><\/blockquote>\n<p>  \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 OrmLite \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u00ab\u0432\u0437\u0440\u043e\u0441\u043b\u044b\u0445\u00bb ORM, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c Entity Framework \u2014 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0434\u043d\u0443 INSERT\/UPDATE \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0411\u0414. \u0425\u043e\u0442\u044f \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f INSERT \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dd776382(v=SQL.100).aspx\">Row Constructor<\/a>, \u043d\u043e \u043d\u0435 \u0441\u0443\u0434\u044c\u0431\u0430. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0437\u0430 \u0441\u0447\u0435\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0430\u043c\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u0410 \u0442\u0430\u043a \u043b\u0438 \u0432\u0435\u043b\u0438\u043a\u0430 \u044d\u0442\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430?<br \/>  \u041d\u0438\u0436\u0435 \u2014 \u0437\u0430\u043c\u0435\u0440\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 10<sup>3<\/sup> \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Order \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Entity Framework \u0438 OrmLite. \u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f 10<sup>3<\/sup> \u0440\u0430\u0437, \u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e <b>\u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435<\/b> \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445). \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/aidforwork\/PaperSource.EF.SqlBulkCopy\">GitHub<\/a>.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\"> .NET 4.5<br \/>   MS SQL Server 2012<br \/>   Entity Framework 6.1.3 (Code First)<br \/>   OrmLite 4.0.38  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">Entity Framework:  <\/p>\n<pre><code class=\"cs\">    \/\/select     context.Orders.AsNoTracking().ToList();     \/\/insert     context.Orders.AddRange(orders);     context.SaveChanges();     \/\/update     context.SaveChanges(); <\/code><\/pre>\n<p>  OrmLite:  <\/p>\n<pre><code class=\"cs\">    \/\/select     db.Select&lt;Order&gt;();     \/\/insert     db.InsertAll(orders);     \/\/update     db.UpdateAll(orders); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445:  <\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td><b>Select<\/b><\/td>\n<td><b>Insert<\/b><\/td>\n<td><b>Update<\/b><\/td>\n<\/tr>\n<tr>\n<td>EF<\/td>\n<td>4,0<\/td>\n<td>282<\/td>\n<td>220<\/td>\n<\/tr>\n<tr>\n<td>OrmLite<\/td>\n<td>7,3<\/td>\n<td>94<\/td>\n<td>88<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  OrmLite, \u0442\u044b \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e? Select \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u0443 EF? \u041f\u043e\u0441\u043b\u0435 \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u0438\u0437\u043c\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u044f 1 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e Id.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">Entity Framework:  <\/p>\n<pre><code class=\"cs\">    context.Orders.AsNoTracking().FirstOrDefault(order =&gt; order.Id == id); <\/code><\/pre>\n<p>  OrmLite:  <\/p>\n<pre><code class=\"cs\">    db.SingleById&lt;Order&gt;(id); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445:  <\/p>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td><b>Select single by id<\/b><\/td>\n<\/tr>\n<tr>\n<td>EF<\/td>\n<td>1,9<\/td>\n<\/tr>\n<tr>\n<td>OrmLite<\/td>\n<td>1,0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0443 OrmLite \u043f\u043e\u0447\u0442\u0438 \u0434\u0432\u0443\u0445\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u0435\u0441, \u0438 \u044d\u0442\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u041e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u0445 \u043f\u0430\u0434\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 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u043a \u0438\u0437 \u0411\u0414 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0435\u0440\u0443\u0441\u044c. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 OrmLite \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 EF, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u2014 \u0432 2-3 \u0440\u0430\u0437\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445 \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u0440\u044f\u043b\u043e\u0441\u044c \u043e\u0431\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f SQL-\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u043d\u043e\u0441\u0438\u0442 \u0432 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u00ab\u0431\u043e\u0435\u0432\u043e\u0433\u043e\u00bb \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 SQL Server \u043c\u044b \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u00ab\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435\u00bb \u0432\u0440\u0435\u043c\u0435\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 ORM. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.  <\/div>\n<\/div>\n<p>  <a name=\"P7\"><\/a><\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0412 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0441\u0432\u043e\u0438\u0445 (\u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445) \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f\u0445 \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 OrmLite, \u043f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u044d\u0442\u043e\u0439 micro-ORM. <br \/>  \u041f\u043b\u044e\u0441\u044b:  <\/p>\n<ul>\n<li>\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u043e\u0441\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438;<\/li>\n<li>\u043f\u0440\u043e\u0441\u0442\u044b\u0435 CRUD-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c;<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:  <\/p>\n<ul>\n<li>\u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (\u0442\u043e \u043b\u044f\u043c\u0431\u0434\u044b, \u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL, \u0442\u043e SqlExpression) \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041d\u0435\u0442 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043b\u044e\u0431\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0438\u0437 API;<\/li>\n<li>\u0441\u043b\u0430\u0431\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 XML-\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043b\u043e\u0445\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435;<\/li>\n<li>\u043d\u0435\u044f\u0441\u043d\u044b\u0439 API. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u0445\u043e\u0434\u0443 \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u044b db.Select, db.LoadSelect, db.Where? \u0418\u043b\u0438 db.Insert \u0438 db.Save? \u041f\u0440\u0438\u0435\u0434\u0443\u0442 \u043b\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b navigation properties \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 db.Join?<\/li>\n<\/ul>\n<p>  \u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0442 \u00ab\u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f\u00bb \u0432 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e. \u041e\u0442\u0447\u0430\u0441\u0442\u0438, \u044d\u0442\u043e \u043b\u0438\u0448\u0430\u0435\u0442 OrmLite \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 micro-ORM \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u00ab\u0432\u0437\u0440\u043e\u0441\u043b\u044b\u043c\u0438\u00bb ORM. \u0412 \u0446\u0435\u043b\u043e\u043c, \u0443 \u043c\u0435\u043d\u044f \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0439\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435. OrmLite \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u043d\u0430 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e, \u043d\u043e \u043e\u0442 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0435.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/256791\/\"> http:\/\/habrahabr.ru\/post\/256791\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \tOrmLite \u2014 \u044d\u0442\u043e \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u0430\u044f micro-ORM \u0441 <a href=\"https:\/\/github.com\/ServiceStack\/ServiceStack.OrmLite\">\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c<\/a> \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0438 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u043e\u0439 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 (<a href=\"https:\/\/servicestack.net\/download#free-quotas\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430<\/a> \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0432 10 \u0442\u0430\u0431\u043b\u0438\u0446). \u0412\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/servicestack.net\/\">ServiceStack<\/a> (\u0438 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u2014 \u0432\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 <a href=\"https:\/\/github.com\/StackExchange\/dapper-dot-net#performance-of-select-mapping-over-500-iterations---poco-serialization\">benchmark<\/a> \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Dapper). \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 OrmLite \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 SQL Server. \u0415\u0441\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c OrmLite \u0438 Entity Framework, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 (change tracking). \u0418 \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f.<\/p>\n<p>  \u041f\u043b\u0430\u043d \u0441\u0442\u0430\u0442\u044c\u0438:  <\/p>\n<ul>\n<li><a href=\"#P1\">\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435. Code-first \u0438 database-first \u043f\u043e\u0434\u0445\u043e\u0434\u044b<\/a><\/li>\n<li><a href=\"#P2\">\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0411\u0414<\/a><\/li>\n<li><a href=\"#P3\">JOIN \u0438 navigation properties<\/a><\/li>\n<li><a href=\"#P4\">Lazy \u0438 Async<\/a><\/li>\n<li><a href=\"#P5\">\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"#P6\">\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 OrmLite \u0438 Entity Framework<\/a><\/li>\n<li><a href=\"#P7\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/li>\n<\/ul>\n<p>  \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/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-256624","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256624","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=256624"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256624\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}