C# 中的非易失性对象
我希望能够在 Web 服务轮询应用程序的应用程序负载之间维护计数和上次访问日期。我不太确定最好的方法是什么。我不喜欢将数据存储在数据库中的想法,因为我必须专门为此目的创建一个数据库。我还有哪些其他选项?是否有任何特别好的方法可以在应用程序的后续运行之间保持应用程序状态?
I want to be able to maintain a count and a last accessed date across application loads for a web service polling application. I'm not too sure what the best way to do this is. I dont like the idea of storing that data in a database as I would have to create one specifically for the purpose. What other options do I have and are there any particularly nice ways of keeping application state between subsequent runs of the app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
持久数据是吗?我建议一个数据库或文件。
您可以将解决方案XML 序列化到文件并在应用程序启动时再次加载。
如果数据是共享的或可能会增长,那么数据库可能是最好的解决方案。如果您愿意,您可以在众多免费项目中找到一个适合您需求的项目:
您可以推出自己的不涉及数据库的解决方案,但很可能有一个适合您的需求和学习它的用途不仅仅限于手头的项目。
Persisting data eh? I suggest a database or file.
File solutions you can just XML serialize to a file and load it again when the app starts.
If the data is shared or might ever grow, then a database is probably the best solution. You can find one that fits your need among the many free projects if you wish:
You could roll your own solution that doesn't involve a database, but most likely there is one that fits your needs and learning it would be useful beyond just the project at hand.
不要害怕为您的网站创建一个“配置”样式表,该表只有几行,可让您根据需要存储运行时信息。
完全没问题。
Don't be afraid to make a 'configuration' style table for your website, that simply has only a few rows and let's you store runtime information as needed.
Perfectly fine.