SQL Server CE 4.0 w/ SQLmetal
I've created a small test project in WebMatrix which uses SQL Server CE 4.0. Not being a fan of using embedded SQL, I wanted to create some LINQ2SQL domain classes for t开发者_如何学JAVAhe SQL Server CE 4.0 database generated by WebMatrix. Unfortunately SQLmetal complains that the database file is corrupt or incompatible.
Is there a version of SQLmetal.exe
that is compatible with SQL Server CE 4.0 and can it be downloaded independently of Visual Studio?
Thanks in advance.
Sql metal doesnt work with sqlce 4.0 (i tried), you must use linq2entity or code your data object and POCOS by hand. Or wait till the next version of visual studio maybe. I hope microsoft will still support linq2sql for sqlce4.0 as it is easy to work with.
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5" />
<add name="Microsoft SQL Server Compact Data Provider 4.0"
invariant="System.Data.SqlServerCe.3.5"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
Still works, you need this simple hack:
- Find
SqlMetal.exe
executable path (from VS cmd: where SQlMetal) - Edit
SqlMetal.exe.config
, add or updating 'system.data' section under 'configuration', overriding SQL Server CE DataProvider 3.5 with the 4.0:
Still an issue with Windows 8 and Visual Studio 2012 by the looks of it as SSCE 3.5 is not installed by default on Windows 8.
精彩评论