designing a class library that uses .xsd files

W

wh1974

I need to move some code which at present is residing in some .aspx
codebehind files into a separate class library.

One of the functions makes use of an xml schema to create the structure
for a DataSet object which is returned to the caller. Currently the
schema is stored in an .xsd file which exists in the /schemas folder
underneath the root of the website.

If I were to move this function into a class, I'm unsure of the correct
way I should be accessing the .xsd file. The class needs to be portable
and so mustn't assume that it's running as part of a web app and thus
shouldn't look in the /schemas folder.

Am I right in thinking that the only way is to distribute the .xsd file
with the .dll used for the new class library I intend to create.

Wayne.
 
N

Nick Malik [Microsoft]

sounds like a simple design problem.

When extracting the code into your dll from the code-behind, change is
slightly to take either the XSD file's filename, or a stream containing the
XSD file. The calling code will get that responsibility, while the called
code will simply use the passed information to perform the necessary
activities.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
W

wh1974

Thank you for your suggestion.

Before I implement this change in the design, what are your thoughts of
including the .xsd file as a resource embedded in the assembly?

Thanks once again,
Wayne.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top