Hello guys!

I am new to web development in general and C# particularly.

Recently I have been given a project to create a simple web application, using C# and .NET.

The application is divided into three parts: Data Access Layer with an XML file attached to it, the Business Layer and the User Interface Layer.

So the question is- could anyone give me a guideline or a clue on how to design the DAL using XML (The tutor said I shoulsn't use SQL for this purpose). I spent whole day to find any tutorial on XML Data Access, but couldn't fins any info on that. (((

If possile, could you please provide me with a link to a sample code or step by step tutorials on XML file based DAL using C# in Visual Studio Express.

Thanks in advance and sorry to bother you with such a newbie question.

Recommended Answers

All 4 Replies

You could look at LINQ to XML. I use it all the time to read XML files and parse them.

http://msdn.microsoft.com/en-us/library/bb387098.aspx

If this is for an assignment, I'll leave the actual DAL building up to you, but LINQ to XML will provide you the mechanisms for reading the XML file and generating objects you require.

As alc6379 says, LINQ to XML would be the best way of going about it.

Thanx guys, I will go fot LINQ then I suppose. Any idea how do I build DAL using LINQ?

"Building a DAL" is pretty broad. You just write methods that return objects. The methods use the LINQ to XML to build those objects. The methods could take parameters to filter down the XML you're reading.

What part of that are you having issues with? I just did a Google search that might yield some result for you:

http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=building+a+DAL+Linq+to+xml

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.