Updated DBFile with some more extension methods

by Jason Haley 13. July 2009 20:40

Tonight I’m preparing for Wednesday’s discussion on Azure and have been adding some updates to the DBFile project (one of the samples I’m going to show is the AzureBlobProvider in DBFile).

I updated the app.config in the DBFile.WinApp to include the default settings for running the provider with the local Data Storage service (though I think the default provider is still set to be the FileSystemProvider).  This means all you need to start playing around with this provider is the Azure SDK (and all its prerequisites of course).

Things I added to the project tonight (besides some unit tests):

New extension methods:

public static XElement LoadFromDB(this XElement element, string filename)

public static void SaveToDB(this XDocument document, string filename)

public static void SaveToDB(this XElement element, string filename)

This last one has a strange usage since XElement doesn’t have a default constructor … so not sure how long it will last.

I also created a new class to wrap XmlMappingSource (since it’s sealed and mostly static – I wrapped it for a single method:

public class XmlMappingSourceWrapper
{
public static XmlMappingSource FromDb(string filename)
{
return XmlMappingSource.FromStream(DBFile.Open(filename));
}
}

I haven’t used the XmlMappingSourceWrapper yet … but now using DBFile as a source for the xml means it could be in a database, on the file system, on another server or in Windows Azure blob storage.

Comments (0) | Post RSSRSS comment feed |

Categories:
Tags:

Comments are closed