This project is read-only.

SqlCeDatabaseCreator.Delete() - File.Delete(string) no likey "|DataDirectory|""

Nov 6, 2011 at 7:50 PM

[See source file: MadMediaManager.DataAccess\Database\SqlCeDatabaseCreator.cs]


I have only been able to successfully load MadMediaManager after replacing:

File.Delete(conneection.Database); // conneection.Database = "|DataDirectory|MadMediaManager.sdf"; Results in System.ArgumentException: {"Illegal characters in path."}


if (File.Exists(@"C:\Users\campbeja\Desktop\MediaManager\MadMediaManager\bin\Debug\MadMediaManager.sdf"))
	File.Delete(conneection.Database); // Of course, this is not touched because MadMediaManager.sdf does not yet exist

Is there something I need to set up translate "|DataDirectory|" to valid file path string? I found this forum post but I do not see where we set the AppDomain in this project solution.

Thanks for helping!


Nov 8, 2011 at 3:08 PM

I should also add that I got the file path:
when experimenting with:


So when we're putting the connection to work, |DataDirectory| is translated to the project's .exe file path.

So I believe the question is "How do I get the value of |DataDirectory| so that I may delete the database file?" 

Nov 8, 2011 at 3:13 PM

Ok, this may be the answer

But I want to assume that the program launches for you without any runtime errors--because I may just be in the wrong on this.



Nov 11, 2011 at 3:24 AM
Edited Nov 11, 2011 at 3:25 AM

Oh, no, it doesn't launch for me, hahaha.  When I created this, NHibernate was in alpha for 3.0 and SQL CE 4.0 was in CTP.  We'll probably be gutting the data access layer and taking a fresh look at it.