Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have an entity 4.0 model that is using a SqlServerCE database as its provider. I am trying to add a SQL Server Connection string so that, I can use choose to use either SQL Server or SQLCompact database.

Here is my Connection String

<?xml version="1.0" encoding="utf-8"?>      
<configuration>     
 <configSections>    
 <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
 </configSections>          

 <connectionStrings>    
 <--<add name="SomeDBEntities" connectionString="metadata=res://*/SomeDB.csdl|res://*/SomeDB.ssdl|res://*/SomeDB.msl;provider=System.Data.SqlServerCe.4.0;provider connection string=&quot;Data Source=ABC.sdf&quot;" providerName="System.Data.EntityClient" />-->    

 <add name="SomeDBEntities" connectionString="metadata=res://*/SomeDB.csdl|res://*/SomeDB.ssdl|res://*/SomeDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=Database;Initial Catalog=MyDatabase;Integrated Security=True;multipleactiveresultsets=True;&quot;" providerName="System.Data.EntityClient" />      
 </connectionStrings>    
 <entityFramework>    

 <!--<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">    <parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
 </defaultConnectionFactory>-->

 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
 <parameters>      

 <parameter value="Data Source=Database;Integrated Security=True;multipleactiveresultsets=True" />    
 </parameters>
 </defaultConnectionFactory>

<-- -->

When I attempt to query the Entity Model, I get the following error: SqlCeCommand.CommandTimeout does not support non-zero values.

How do I set the provider from SqlServerCE to SqlClient?

share|improve this question
    
I think you need to modify the edmx file also. –  ErikEJ Apr 12 at 6:41
add comment

1 Answer

The SqlServerCE provider is specified in the edmx file.

You need to create a Second SSDL File as it is described here : http://www.codeproject.com/Articles/82017/Preparing-an-Entity-Framework-model-for-multi-prov.aspx

share|improve this answer
    
Tried it without luck. Couldn't add a second SSDL file. –  user2330678 Jun 23 at 17:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.