DbProviderFactoryRepository: Managing DbProviderFactories in code

added by sandrino
2/4/2011 9:56:07 AM

0 Kicks, 76 Views

After creating a small console application with LINQ to SQL and SQL CE 3.5 all worked fine. Based on the How to: Deploy a SQL Server Compact Edition Database with an Application article on MSDN I deployed this small application to Windows XP running on a Virtual Machine with only a few Service Packs installed. Running the application raised an InvalidOperationException: Cannot open 'TestDatabase.sdf'. Provider 'System.Data.SqlServerCe.3.5' not installed. When working with LINQ to SQL it wasn't sufficient to deploy the assemblies to the applciation folder, the application also required a provider for SQL Server CE. After a quick search I found the following topic on the MSDN forum: Can I XCopy SQL CE 3.5? yes and no, see message. In this topic someone described how you can create the provider using the App.config