问题
My application is something similar to a Contact Manager. Let's say a user can enter contacts with their addresses. I have the code and technology to save my contacts to a file. But where do I save that file?
Considering this is a .NET application running on Windows. Should my file end up in the AppData of the users folder? Should I use the Isolated Storage (as mentioned here)? Something else? What's the recommended practice?
回答1:
I ended up using the solution Patrick suggested:
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
回答2:
You have a number of options; as you say, Isolated Storage is one of them. You could also use the User Settings framework feature and save the data as a blob of data, or as XML.
You could also take a look at SqlCompact for a very lightweight in-process database. You can then save all user contacts in a single database which could live e.g. in the same directory as the application; you could easily use something like EF4 for your DAL.
That might be a bit more effort though, as it sounds like you are 99% of the way there with your current architecture.
来源:https://stackoverflow.com/questions/4650209/where-to-save-application-data-in-net-application