Pisang wrote:
That’s the problem indeed.
Solution: We have copied the appSetting key with the connection string to the devenv.exe.config located: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE (on our pc)
Do not forget the set this value back at the end of the project.
If there is a better sollution please tell us.
I don't have a proper solution, I'm afraid. The entity doesn't know in which collection it is added, so it can't check if the containing collection's Site property is null or not (it's not null if in design mode, which is pretty much the only way to check it). Then it would be possible to set DbUtils.ActiveConnectionString to a value which makes sense. This can also be done to an override of AddNew in the entitycollection, however that's also not that appealing, as it's code you don't need at runtime.
Btw, the routine you have in the init routine, isn't that pretty inefficient for just fetching 1 value? Couldn't you better use a GetScalar() with a filter ? Not that that helps in your situation.
I could wrap the DbUtils routine which reads the connection string into a try/catch, swallow the exception and later on make the connection using code simply don't do anything if the connection fails to open. However that would bypass signals which are essential for finding bugs earlier, so I can't do that.