1

I'm using Sql Server Compact Edition v4 with EntityFramework v5. I pass the name of the sdf file into the constructor of my various DbContext inheritors. It works fine but always creates the files in ./App_Data. On my deployed server I want it to create the files in ../../data. Can I specify that data directory as part of the connection factory settings in the web.config? Or if I use a connection string, can I specify some kind of wildcard for the filename itself so that it continues to use the runtime-generated value passed to the DbContext constructor?

2
  • Possible duplicate - EF 5 + SQL CE 4: How to specify custom location for database file? Commented Apr 26, 2013 at 15:35
  • That example is not ideal because it uses CE-specific code. SQL CE is not my long-term solution; it's an intermediate hack that I hope will last until my host solution can support LocalDb. Commented Apr 27, 2013 at 3:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.