{"id":769,"date":"2007-09-03T03:26:00","date_gmt":"2007-09-03T03:26:00","guid":{"rendered":"\/blogs\/bobb\/post\/Using-LINQ-to-SQL-and-EDM-with-SQL-Server-Compact-Edition-35.aspx"},"modified":"2013-01-04T01:49:57","modified_gmt":"2013-01-04T09:49:57","slug":"using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/","title":{"rendered":"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5"},"content":{"rendered":"<p>\nI&#39;ve been trying out LINQ for SQL and the Entity Data Model (EDM) latest betas with some &quot;different&quot; data sources. This post covers using SQLCE 3.5. The latest version of SQLCE 3.5 comes with Visual Studio 2008 Beta 2.\n<\/p>\n<p>\nUsing SQLCE 3.5 data sources doesn&#39;t work with the built-in LINQ for SQL designer in Visual Studio 2008 beta 2 or the CTP EDM designer released shortly after beta 2. You can add a Data Connection for a SQLCE 3.5 database. I used the Northwind.sdf sample database&nbsp;that was supplied. But dragging a SQLCE table on to the LINQ to SQL designer produces &quot;The selected object(s) use an unsupported provider&quot;. The EDM Wizard doesn&#39;t even list the SQLCE ADO.NET data provider as a choice. So there&#39;s no LINQ to SQL or EDM designer support for SQLCE 3.5.\n<\/p>\n<p>\nSQLCE works quite well with SQLmetal, although my attempt to generate a .dbml for the Northwind.sdf sample database produces the error message:\n<\/p>\n<p>\nerror DBML1055: The DeleteOnNull attribute of the Association element &#39;Order Det<br \/>\nails_FK01&#39; can only be true for singleton association members mapped to non-null<br \/>\nable foreign key columns.\n<\/p>\n<p>\nRemoving the &quot;Order Details&quot; table provides a &#39;hit it with a hammer&#39; solution; I haven&#39;t figured out a nicer way to solve this problem yet. Then, the&nbsp;SQLMetal-generated classes worked fine.\n<\/p>\n<p>\nUsing EDMgen against the Northwind.sdf file produced the following error:\n<\/p>\n<p>\nerror 7001: Could not load System.Data.SqlServerCe.Entity.dll. Reinstall SQL Server Compact.<br \/>\nCould not load file or assembly &#39;System.Data.SqlServerCe.Entity, Version<br \/>\n=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91&#39; or one of its depend<br \/>\nencies. The system cannot find the file specified.\n<\/p>\n<p>\nHmmm&#8230;the version of SQLCE that came with Visual Studio 2008 B1 did come with this DLL. And, <a href=\"http:\/\/3.209.169.194\/blogs\/bobb\/sql-server-compact-edition-newest-stuff-sqlce-and-entities\/\" class=\"broken_link\">I had it working with&nbsp;EDM<\/a> then.&nbsp;But the version in VS2008 B2 doesn&#39;t. As a last resort, I installed the SQLCE 3.5 version from VS 2008 B1, it&#39;s out on the web as a separate download. This changed the error message to:\n<\/p>\n<p>\nerror 7001: Method &#39;CreateDbCommandDefinition&#39; in type &#39;System.Data.SqlServerCe.<br \/>\nSqlCeProviderServices&#39; from assembly &#39;System.Data.SqlServerCe.Entity, Version=3.<br \/>\n5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91&#39; does not have an implementation.\n<\/p>\n<p>\nSure enough, the required implementation of the ProviderServices class required for EDM support has changed between VS Beta1 and VS Beta2. I confirmed this by checking the methods in the SqlProviderServices in System.Data.Entity.dll, they did change recently, adding CreateDbCommandDefinition.&nbsp;Unless I can find an updated System.Data.SqlServerCe.Entity.dll somewhere, it doesn&#39;t look like SQLCE is usable with EDM at this point in beta-time.\n<\/p>\n<p>\nThat&#39;s all for now.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#39;ve been trying out LINQ for SQL and the Entity Data Model (EDM) latest betas with some &quot;different&quot; data sources. This post covers using SQLCE 3.5. The latest version of SQLCE 3.5 comes with Visual Studio 2008 Beta 2. Using SQLCE 3.5 data sources doesn&#39;t work with the built-in LINQ for SQL designer in Visual [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,32],"tags":[],"class_list":["post-769","post","type-post","status-publish","format-standard","hentry","category-data-access","category-sql-server-2008","category-sql-server-compact-edition"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5 - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5 - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve been trying out LINQ for SQL and the Entity Data Model (EDM) latest betas with some &quot;different&quot; data sources. This post covers using SQLCE 3.5. The latest version of SQLCE 3.5 comes with Visual Studio 2008 Beta 2. Using SQLCE 3.5 data sources doesn&#039;t work with the built-in LINQ for SQL designer in Visual [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2007-09-03T03:26:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-04T09:49:57+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/\",\"name\":\"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5 - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2007-09-03T03:26:00+00:00\",\"dateModified\":\"2013-01-04T09:49:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Data Access\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/data-access\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5 - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/","og_locale":"en_US","og_type":"article","og_title":"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5 - Bob Beauchemin","og_description":"I&#39;ve been trying out LINQ for SQL and the Entity Data Model (EDM) latest betas with some &quot;different&quot; data sources. This post covers using SQLCE 3.5. The latest version of SQLCE 3.5 comes with Visual Studio 2008 Beta 2. Using SQLCE 3.5 data sources doesn&#39;t work with the built-in LINQ for SQL designer in Visual [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/","og_site_name":"Bob Beauchemin","article_published_time":"2007-09-03T03:26:00+00:00","article_modified_time":"2013-01-04T09:49:57+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/","name":"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5 - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2007-09-03T03:26:00+00:00","dateModified":"2013-01-04T09:49:57+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/using-linq-to-sql-and-edm-with-sql-server-compact-edition-3-5\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Data Access","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/data-access\/"},{"@type":"ListItem","position":3,"name":"Using LINQ to SQL and EDM with SQL Server Compact Edition 3.5"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=769"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/769\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}