{"id":261144,"date":"2015-07-10T17:17:02","date_gmt":"2015-07-10T13:17:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=261144"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=261144","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f LINQ to SQL \u043a\u043e\u0434\u0430 \u0434\u043b\u044f SQLite \u0432 .NET (C#)"},"content":{"rendered":"<p>             \u041d\u0430 C# \u044f \u043f\u0438\u0448\u0443 \u0440\u0435\u0434\u043a\u043e, \u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f MSSQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043b\u0438 \u0441\u043b\u0443\u0436\u0431\u044b \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418 \u0432\u043e\u0442 \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440, \u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0411\u0414. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0432, \u044f \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043b SQLite.<\/p>\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>  \u0423 \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u0432 \u0431\u044b\u043b\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043a\u043e\u0434\u0443:  <\/p>\n<ul>\n<li>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445;<\/li>\n<li>\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u043e\u0434\u0430 (\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043c\u0435\u0442\u043e\u0434\u044b, \u0441\u043e\u0431\u044b\u0442\u0438\u044f&#8230;);<\/li>\n<li>\u0442\u0430\u0431\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u043a\u0430\u0440\u0430\u043b\u043e\u0441\u044c \u0441\u043c\u0435\u0440\u0442\u043d\u043e\u0439 \u043a\u0430\u0437\u043d\u044c\u044e);<\/li>\n<li>\u0437\u0430 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0443\u0434\u0430\u043b\u044f\u043b\u0441\u044f \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/li>\n<\/ul>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e, \u0434\u043b\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b LINQ to SQL, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432 \u043c\u043e\u0435\u043c \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044f \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0441\u043a\u0430\u0447\u0430\u043b \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b <a href=\"http:\/\/sourceforge.net\/projects\/sqlite-dotnet2\/files\/SQLite%20for%20ADO.NET%202.0\/1.0.66.0\/SQLite-1.0.66.0-setup.exe\/download\">SQLite \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440<\/a>, \u0441\u043e\u0437\u0434\u0430\u043b \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0438, \u0441\u0432\u044f\u0437\u0438, \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u043b\u0430\u0441\u0441 LINQ to SQL, \u043f\u0435\u0440\u0435\u0442\u044f\u043d\u0443\u043b \u0432 \u043d\u0435\u0433\u043e \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u043e\u0431\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u0435\u043b\u044f, \u0438\u2026<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/594\/234\/cc7\/594234cc7b9a40e2bf6a8f65003abbc3.png\"\/>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043f\u0440\u0438\u0435\u0445\u0430\u043b\u0438<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ff0\/4cc\/edd\/ff04ccedd43347b2a4aeb5aae3dd93f0.jpg\"\/><\/div>\n<\/div>\n<h2>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u041a\u0443\u0434\u0430 \u0431\u0435\u0436\u0430\u0442\u044c?<\/h2>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0432 \u0433\u0443\u0433\u043b, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0435\u0433\u0430\u0435\u043c \u0432 stackoverflow! \u0422\u0430\u043c \u0443 \u043d\u0430\u0441 over9000 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432:  <\/p>\n<ul>\n<li>\u0434\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 (SQLiteConnection, SQLiteCommand, SQLiteDataReader, SQLiteDataRecord \u0438 \u0442.\u0434.):<\/li>\n<li>\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e;<\/li>\n<li>\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0435\u0440\u0435\u043b\u043e\u043f\u0430\u0442\u0438\u043c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442;<\/li>\n<li>\u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0434\u043b\u044f \u0441\u043b\u0430\u0431\u0430\u043a\u043e\u0432, \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c DataTable \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432&#8230;<\/li>\n<\/ul>\n<p>  \u041d\u0435\u0442, \u043d\u0435\u0442, \u0438 \u0435\u0449\u0435 \u0440\u0430\u0437 \u043d\u0435\u0442. \u0421 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414, \u0432\u044b\u0431\u043e\u0440\u043a\u0443, \u0432\u0441\u0442\u0430\u0432\u043a\u0443, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (DataContext), \u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430!<\/p>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c, \u043a\u0430\u043a \u0438\u0441\u043a\u0430\u0442\u044c \u00ab\u043b\u0435\u0432\u044b\u0435\u00bb \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0432 \u0438 \u0432\u0437\u0432\u0435\u0441\u0438\u0432 \u0432\u0441\u0435 \u00ab\u0437\u0430\u00bb \u0438 \u00ab\u043f\u0440\u043e\u0442\u0438\u0432\u00bb, \u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/dblinq\/dblinq2007\">dblinq2007<\/a>.<\/p>\n<p>  \u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0437\u0436\u0435, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0430\u0439\u043b \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0430 \u0441\u0442\u0443\u0434\u0438\u0439\u043d\u044b\u0439 LINQ to SQL \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0411\u0414 \u0438 \u0441\u0432\u044f\u0437\u044f\u043c\u0438! \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e, \u0447\u0442\u043e \u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e, \u0438 \u044f \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u041f\u0435\u0440\u0432\u044b\u0439 exception: dblinq2007 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f Framework 2.0, \u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c 4.0. \u041a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432 \u0441\u0442\u0443\u0434\u0438\u0438, \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c 4\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c dblinq2007!<\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u0434\u0430<\/h2>\n<p>  \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b dblinq2007, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u043e\u0432 \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f DbMetal.exe. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u0443\u0440\u0438\u043c \u0435\u0433\u043e \u0434\u043e\u043a\u0438, \u0438, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0441\u043f\u0440\u0430\u0432\u043a\u0443, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0438 DbMetal \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043c DBML \u0444\u0430\u0439\u043b \u0434\u043b\u044f SQLite:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1b8\/5bd\/ad1\/1b85bdad1d3c405f862ab627d3118ec5.png\"\/><\/p>\n<p>  \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c DBML-\u043c\u043e\u0434\u0435\u043b\u044c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/134\/761\/94b\/13476194b8434a34a5965a07ce53fa75.png\"\/><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 DBML \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c CS \u0444\u0430\u0439\u043b (\u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 DBML \u0444\u0430\u0439\u043b), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0430\u0448\u0435\u0439 \u0411\u0414 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0441\u0432\u044f\u0437\u044f\u043c\u0438. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <b>Main <\/b>\u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <b>DataContext<\/b>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/317\/112\/866\/31711286663e48ac88e682f1f51bb37b.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 DBML \u0444\u0430\u0439\u043b. \u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u0443\u0434\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 SQLite, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u041e\u0431\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u0435\u043b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0438, \u0438 \u043f\u0435\u0440\u0435\u0442\u044f\u043d\u0443\u0442\u044c \u0438\u0445 \u0432 DBML \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/346\/4bb\/cf9\/3464bbcf98364f17a72404b0353289f8.png\"\/><\/p>\n<p>  \u041f\u043e\u0431\u0435\u0434\u0430!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f4e\/827\/da2\/f4e827da23a44e3eb5118768fc3b43ce.png\"\/><\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0432\u0441\u0435. \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c LINQ \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u043d\u0430\u0448\u0435\u0439 \u0411\u0414 \u0438 \u043d\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0441\u0432\u044f\u0437\u044f\u043c\u0438.<\/p>\n<pre><code class=\"cs\">public class Test {         private void Example()         {             \/\/\u0431\u0435\u0440\u0435\u043c \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0411\u0414             SQLiteConnection Connection = new SQLiteConnection(Properties.Settings.Default.connectionString);             Connection.Open();              \/\/\u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 DatabaseContext, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0411\u0414             Main dbContext = new Main(Connection, new SqliteVendor());                          \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435             List&lt;Order&gt; OrderList = (from o in dbContext.Order                             select o).ToList();             \/\/\u0438\u043b\u0438 \u0442\u0430\u043a             List&lt;Order&gt; OrderList = dbContext.Order.Take(10).ToList();              \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u0437\u0430\u043a\u0430\u0437\u0430 \u0438\u0437 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b             string OrderStatus = OrderList[0].OrderStatus.Name;              \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0437\u0430\u043a\u0430\u0437\u0430             List&lt;OrderUnit&gt; OrderUnits = OrderList[0].OrderUnit.ToList();              \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u0438             List&lt;MenuImages&gt; UnitImages = OrderList[0].OrderUnit[0].Menu.MenuImages.ToList();              \/\/\u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435             Order ord = new Order()             {                 OrderNumber = 1,                 ToTime = DateTime.Now             };             dbContext.Order.InsertOnSubmit(ord);             dbContext.SubmitChanges();                          \/\/\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435             dbContext.Order.DeleteOnSubmit(OrderList[0]);             dbContext.SubmitChanges();              \/\/\u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435             Connection.Close();         } } <\/code><\/pre>\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\/262279\/\"> http:\/\/habrahabr.ru\/post\/262279\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>             \u041d\u0430 C# \u044f \u043f\u0438\u0448\u0443 \u0440\u0435\u0434\u043a\u043e, \u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f MSSQL \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u043b\u0438 \u0441\u043b\u0443\u0436\u0431\u044b \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418 \u0432\u043e\u0442 \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440, \u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0411\u0414. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0432, \u044f \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043b SQLite.<\/p>\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>  \u0423 \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u043e\u0432 \u0431\u044b\u043b\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043a\u043e\u0434\u0443:  <\/p>\n<ul>\n<li>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445;<\/li>\n<li>\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043a\u043e\u0434\u0430 (\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043c\u0435\u0442\u043e\u0434\u044b, \u0441\u043e\u0431\u044b\u0442\u0438\u044f&#8230;);<\/li>\n<li>\u0442\u0430\u0431\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u043a\u0430\u0440\u0430\u043b\u043e\u0441\u044c \u0441\u043c\u0435\u0440\u0442\u043d\u043e\u0439 \u043a\u0430\u0437\u043d\u044c\u044e);<\/li>\n<li>\u0437\u0430 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0443\u0434\u0430\u043b\u044f\u043b\u0441\u044f \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/li>\n<\/ul>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e, \u0434\u043b\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b LINQ to SQL, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438.  <\/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-261144","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/261144","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=261144"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/261144\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=261144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=261144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=261144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}