I'm working on a proof-of-concept application, containing a WCF service with console host and client, both on a single USB device. On the same device I will also have the client application which will connect to this service. The service uses the entity framework to connect to the database, which in this POC will just return a list of names. If it works, it will be used for a larger project.
Creating the client and service was easy and this works well from USB. But getting the service开发者_如何学Python to connect to the database isn't. I've found this site, suggesting that I should modify machine.config but that stops the XCopy deployment. This project cannot change any setting of the PC, so this suggestion is bad. I cannot create a deployment setup either. The whole thing just needs to run from USB disk.
So, how do I get it to run?
(The service just selects a list of names from the database, which it returns to the client. If this POC works, it will do far more complex things!)
Awww. Solved it. Just needed to add this to the .config file.
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5"></remove>
<add name="Microsoft SQL Server Compact Data Provider"
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=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
Adding it to the local config file works just fine too. :-)
Have you thought of using an In Memory database (if it suits your application).Some time back i had worked on a project where a web application was given offline as a desktop product.We had used HSQLDB as the in memory database, and for us it worked well (the database was also small)
精彩评论