EF + SQL Ce 4.0 private installation + without using the App.config + AutoCAD 2012 -> SqlCeConnectionFactory
-
Saturday, May 12, 2012 7:20 PM
Hello,
After struggling for 12 hours I have finally given up. My situation is as follows.
I want to use SqlCe.4.0 inside AutoCAD 2012. I don`t want to insert any config inside the autocad.exe.config, because it crashes.
I want to setup the EF + SqlCe.4.0 to use the private installation ( the locally copied dlls ) but I have failed to achieve that without the xml config files, because it is a DLL and not an exe. -> It is run inside AutoCAD.
I use the nuGet package with id : EntityFramework.SqlServerCompact that directly deploys the EF and SQLCe.4.0 but it foes it with configs! ( App.config ) and it works fine for console app.
I want to be able to provide the connection string to my DbContext derived class in order to be able to change the name and location of the .sdf file too.
My guess is that the problem is with setting the
Database.DefaultConnectionFactory = new SqlCeConnectionFactory("xyz");
but I cant figure out how to tell the EF to use the local dlls. Whatever I try to set I get "Unable to find the requested .NET Data Provider" when trying to start on client machine that does not have SqlCe.4.0 installed.
I tried this http://sondreb.com/blog/post/database-provider-factories-ef-sql-compact.aspx already but it is with config too.
Please help me! :)
- Edited by Ognyan Saturday, May 12, 2012 7:58 PM Clarification
All Replies
-
Sunday, May 13, 2012 1:48 PMModerator
Hi Ognyan,
Welcome to MSDN Forum.
I'm not clear about the question, do you mean, you want to pass a connection string to the class which derived from DBContext without configuration file? If yes, have you seen this link? You can use DBContext constructor to pass a connection string to it. Other DbContext constructor options section introduces that. If I understand incorrectly, please feel free to correct me.
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
-
Tuesday, May 15, 2012 9:28 AMI provide direct string to the constructor just like in the example but it throws me the exception. It looks that EF can not find SQL Ce. Here I have uploaded my test project. It is simple console app. It runs on my dev cmoputer but it does not run on any other that has not SQL Ce installed : http://www.mediafire.com/?xigb79z5txjkkhu
-
Wednesday, May 16, 2012 5:58 AMModerator
Hi Ognyan,
I've downloaded the file, but I couldn't open it. An exception window appears when I open the project. My IDE is Visual Studio 2010.
Best Regards
Allen Li [MSFT]
MSDN Community Support | Feedback to us
- Edited by Allen Li - AI3Microsoft Contingent Staff, Moderator Wednesday, May 16, 2012 5:58 AM
-
Wednesday, May 16, 2012 8:52 AM
You can very easily replicate the problem -
1. Make a console app project
2. Search for "EntityFramework.SqlServerCompact" in the nuget package manager.3. Make 1-2 dummy classes just to start the EF.
4. Build
5. Start the program on computer that does not have the SqlCe installed.
And you will get the problem.
In the link I provide you the full solution with an already compiled version for "Any CPU" that I have just tested - it works on computer with SqlCe runtime installed, but it does not run on VM with no SqlCe.
ErikEJ answerd the question here by pointing to his article and says that when I have EF it is not possible to make a private install work and I need the good old ADO.NET. I really wanted the code first approach here but ADO.NET will do the job well too.
But I wonder if it possible to insert the configuration inside AutoCADs config in acad.exe.config and make able the EF to read the config from there. Is it possible?
Or if I point the EF to read config from somewhere else?
Is it possible to use ocnfig with a dll or something else? ( that I don`t know for sure )
Thank you for your time to read and answer my question.- Edited by Ognyan Wednesday, May 16, 2012 9:14 AM Clarificaiton
-
Tuesday, May 22, 2012 2:14 PMModerator
Hi,
Your question falls into the paid support category which requires a more in-depth level of support. Please visit the following link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
Thanks,
Cathy Miller
-
Tuesday, May 29, 2012 2:10 PMI have MSDN essentials subscription. Do I have rights for such support?
-
Wednesday, May 30, 2012 1:25 PMModerator
Hi,
This type of question falls under the Advisory Services category rather than Problem Resolution Services category:
http://support.microsoft.com/gp/advisoryservice
I believe the MSDN subscription incidents are in the Problem Resolution category.
Thanks,
Cathy

