I have the following solution structure:
Portal.DataAccess -> Class library project with methods against database…
Portal.DomainEntities -> Class library project (Where i have my storage classes)
Portal.Business -> class library (proxy between front end and data access)
Portal.Web -> class library with references to web context (system.web.mvc, etc…)
Portal.Web.Website1 -> My website 1
Portal.Web.Website2 -> My website 2
….
Portal.Web.WebsiteN -> My website N
All my websites uses the same queries, and i would like to create a file with the following structure:
<?xml version="1.0" encoding="utf-8" ?>
<Queries>
<Query>
<Name>DetailArticle</Name>
<Value>
<![CDATA[
select * from Articles where ID={ID}
]]>
</Value>
..... All my queries here
</Queries>
Where do you think is the best place to put this xml file that will be deserialized for use? I think that could be good to have it into Portal.DataAccess as an embedded resource but my issue is that i dont want to access to disk everytime i want to do a query. In addition, this project doesnt contains references to WebContext (so i cannot put this in cache). For this reason i was thinking to put this file on Portal.Web which is a project with common funcionality for all websites.
What’s your recomendation? Is there any other place (apart from web cache) to put the deserialized class of the xml?
I think the best place will be dataacess project. Also, you could add this file to all other projects not directly, but using “add as link” option. It will allow you to change stuff only in one place and all the changes will automatically done in all ‘related’ files.
Also, if you want to have this queries inmemory during you app working, than it could be reasonable to put file to the root of directory and implement simple static class, which will be read this queries when applcation start and then using this class to read queries you need from memory.