About Database.DoesDatabaseExists Method

Jul 20, 2010 at 1:38 AM
Edited Jul 20, 2010 at 1:48 AM

Hi,

Thanks for this contribution, nice work.

I think that's cool to allow external code to use the Database.DoesDatabaseExists Method to check for database existence before trying to create a new one.

I know that the DatabaseExistsException fill this case but it's pretty nice to use the first way also.

please make it public.

Regards

Waleed

 

Coordinator
Jul 20, 2010 at 1:43 AM

Very good suggestion, Waleed.

Thanks.  I will try to work on it this weekend.

Sergey

May 6, 2011 at 9:59 AM
Edited May 6, 2011 at 10:00 AM

When I start my application it checks for creating a database or not:

        If Not Database.DoesDatabaseExists(DatabaseName) Then
            db = Database.CreateDatabase(DatabaseName)
            db.Save()
        Else
            db = Database.OpenDatabase(DatabaseName, String.Empty, False)
        End If

But I get an IsolatedStorageException when using DatabaseExists:

 

The application identity of the caller cannot be determined
    System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope scope, Type appEvidenceType)
    System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope scope, Type applicationEvidenceType)
    System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication()
    SilverlightPhoneDatabase.Database.DoesDatabaseExists(String databaseName)
Maybe there's something wrong the way I use this method?
Coordinator
May 6, 2011 at 11:06 AM

I am guessing you are making this call too early in the applicaiton lifecycle.  If you post a repro, I can take a closer look for you.  You can always email me the code if you would like.

Thanks

Sergey

May 11, 2011 at 10:33 AM

You're right! Thank you Sergey!