Open-Source ADO.NET XML Provider -- WilsonXmlDbClient v1.0

Have you ever wanted to work with your Xml files as if they were databases?  Would you like to use SQL Select statements, instead of XPath, to retrieve, filter, and sort your Xml data?  What about using SQL Insert, Update, and Delete statements, in transactions, against your Xml data?  OK, I haven't either, but I had someone request the ability for my WilsonORMapper, and all that's necessary is an ADO.NET provider that knows how to work with Xml.  I like a good challenge, and couldn't find one already done, so I took a little of my spare time and created just such an ADO.NET provider that anyone can use.

So I'm hereby announcing the open-source release of v1.0 of the WilsonXmlDbClient.  The WilsonXmlDbClient is an ADO.NET provider that enables Xml to be worked with just like any other database in .NET. It supports the most common Select, Insert, Update, and Delete SQL syntax, as well as tranactions and parameters.  It works with your own ADO.NET data access code, as well as the WilsonORMapper, and it most likely will work with other ORMappers with very few changes to those mappers.  I was rejected by SourceForge, unlike my WilsonWebForm, for some reason they didn't specify, so this is on GotDotNet.

Your Xml file must be in a format that the .NET DataSet can read, and you must include a schema if you want strongly typed data and/or identity fields.  Its easy enough to create a DataSet and then write it out as Xml, so I'm not releasing a tool to do this for you.  The following SQL syntax is supported:

SELECT *|fieldList FROM tableName [WHERE whereClause] [ORDER BY sortClause] [LIMIT pageSize] [OFFSET skipRows]
SELECT @@Identity
INSERT [INTO] tableName (fieldList) VALUES (valueList)
UPDATE tableName SET updateList [WHERE whereClause]
DELETE [FROM] tableName [WHERE whereClause]

Fields and tables can optionally be delimited by [ and ], parameters must start with @, and you can optionally use ; for the statement terminator.  No group by, sql functions, table joins, or multiple recordsets are currently supported, and you cannot use the DataAdapter for persistence (use the Sql commands instead).  Also, note that my Sql parsing is pretty "raw" (maybe someone can join the workspace and fix this), so its certainly possible that things can go wrong if your data contains things I'm parsing.  It should also go without saying that this probably isn't going to work very well in a multi-user environment.

You can certainly use this ADO.NET provider in your own code, just like any other provider, but if you do want to use it with my ORMapper, then here's the CustomProvider syntax:

Wilson.ORMapper.CustomProvider customProvider = new Wilson.ORMapper.CustomProvider(
 "WilsonXmlDbClient", "Wilson.XmlDbClient.XmlDbConnection", "Wilson.XmlDbClient.XmlDbDataAdapter");
customProvider.StartDelimiter = "[";
customProvider.EndDelimiter = "]";
customProvider.IdentityQuery = "SELECT @@Identity;";
customProvider.SelectPageQuery = "SELECT * LIMIT {0} OFFSET {1}";


Comments have been disabled for this content.