Use XML instead of a DB?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/21/2008 1:32:14 PM
Gravatar
Total Posts 6

Use XML instead of a DB?

How difficult would it be to make mojoPortal store everything in XML files rather than a database?

If it's not too terribly difficult, could you point me in the right direction?

Thanks!

2/21/2008 1:53:13 PM
Gravatar
Total Posts 18439

Re: Use XML instead of a DB?

Hi,

Implementing a new Data layer is not a trivial task. I think at least in theory an xml data layer could be implemented. The business layer generally wants to consume IDataReader so if there is such a thing as XmlDataReader and it implements IDataReader, then I think its possible.

What you would do to start is create a class library project named mojoPortal.Data.Xml, but then in the project properties make the Assembly name and the default namespace mojoPortal.Data

Now you just have to implement all the static classes and methods by copying the method signatures from one of the other core data layers. You could go by any of them as a guide but probably mojoPortal.Data.MSSQL or mojoPortal.Data.MySql is what I would use as a guide. (Though there may be a few unused methods that you could leave out)

When you can change the reference from mojoPortal.Business to your data layer project and it builds then you have implemented all the methods and are ready to test.

It will be a good bit of work I think, but would be very cool if it was implemented.

Best,

Joe

2/21/2008 2:32:01 PM
Gravatar
Total Posts 6

Re: Use XML instead of a DB?

Thanks for the quick reply Joe. I'll look into this.

-Mike

2/21/2008 2:40:44 PM
Gravatar
Total Posts 18439

Re: Use XML instead of a DB?

I did a little googling and there doesn't seem to be an XmlDataReader built into the .NET framework. Looks like Paul Wilson once implemented one and had it on gotdotnetworkspaces but its disappeared. Maybe more googling would turn up some additional alternatives.

Joe

2/21/2008 2:47:44 PM
Gravatar
Total Posts 148

Re: Use XML instead of a DB?

FWIW, If you want to use XML because you don't want a separate DB server, you might also want to consider just using the SQLite database layer instead of XML since it doesn't require any DB server.

 

2/21/2008 2:49:57 PM
Gravatar
Total Posts 6

Re: Use XML instead of a DB?

I've never used SqlLite. How does this compare to say, MS Sql Express?

2/21/2008 2:53:27 PM
Gravatar
Total Posts 2

Re: Use XML instead of a DB?

What about using XMLReader? Would that meet the needs in replacing the data reader?

Tim

2/21/2008 2:56:26 PM
Gravatar
Total Posts 18439

Re: Use XML instead of a DB?

Sqlite is a file based db, it only requires a dll and the db file there is no installation needed (on windows) and is often included on linux distros. Its free, open source. I don't think its as fast or robust as as SQLExpress and it also can't be used in medium trust hosting environements. In full trust its easy to use and deploy.

Joe

2/21/2008 2:59:50 PM
Gravatar
Total Posts 18439

Re: Use XML instead of a DB?

Does XmlReader implement IDataReader interface? If so then yes if not then no.

2/21/2008 3:02:30 PM
Gravatar
Total Posts 148

Re: Use XML instead of a DB?

I've never used SQLite either, but I've heard good things about it and it is widely used for apps with a light write load.  SQL Server Express is a proprietary client-server database for Windows.  SQLite is an open source serverless database that is available for a variety of platforms (including Windows, Linux, and Mac OSX).  For more info on SQLite, see the SQLite home page.

 

2/21/2008 3:05:16 PM
Gravatar
Total Posts 2

Re: Use XML instead of a DB?

No, XmlReader does not implement IDataReader.

2/21/2008 3:16:20 PM
Gravatar
Total Posts 18439

Re: Use XML instead of a DB?

Found a post here that has sample code for implementing a custom IDataReader around xml. See the code for SimpleDataReader which forms the base class for XmlDataReader. Code in the post looks more or less complete working example.

Joe

2/21/2008 3:20:30 PM
Gravatar
Total Posts 6

Re: Use XML instead of a DB?

Wow, Joe! Thanks for all your effort! It's nice and reassuring to receive such quick replies!

2/21/2008 3:34:02 PM
Gravatar
Total Posts 18439

Re: Use XML instead of a DB?

Well if you actually implement such a thing it would be a great contribution to the project.

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.