简体   繁体   English

在哪里存储应用程序数据

[英]Where to store application data

I'm building a C#/WPF job search tracking application to keep track of resumes submitted, interviews, followups, etc and am not sure of the best way to store the data. 我正在构建一个C#/ WPF职位搜索跟踪应用程序,以跟踪提交的简历,面试,跟进等,并且不确定存储数据的最佳方法。 Where/how would YOU store the data? 您将在哪里/如何存储数据? My first thought was XML to keep it simple, but it seems like I should "model" my data since there will be lots of related bits of information. 我的第一个想法是XML,以使其保持简单,但是由于应该有很多相关的信息,因此我似乎应该对数据进行“建模”。 Would SQLite be a better choice? SQLite会是更好的选择吗? Other recommendations? 还有其他建议吗?

Since I assume you want to query and update that data I would even suggest an ORM like Entity Framework - it's easy to get started and the basic stuff like querying and updating will be very straightforward if you have worked with LINQ before - saves you the hassle of writing your own SQL queries. 因为我假设您想查询和更新该数据,所以我什至建议使用像Entity Framework这样的ORM,因为它很容易上手,如果您以前使用过LINQ,那么诸如查询和更新之类的基本操作将非常简单-可以省去麻烦编写自己的SQL查询。 This also will allow you to easily extend your model later on should you decide to do so. 这也使您以后可以轻松扩展模型(如果您决定这样做)。

Edit: 编辑:

There are self-contained light-weight alternatives that would still allow you to use LINQ: 有一些自包含的轻量级替代方案,它们仍然允许您使用LINQ:

SQL Server Compact : SQL Server Compact

Microsoft SQL Server Compact is a free SQL Server embedded database ideal for building standalone and occasionally connected applications for mobile devices, desktops, and Web clients. Microsoft SQL Server Compact是免费的SQL Server嵌入式数据库,非常适合为移动设备,台式机和Web客户端构建独立的应用程序,并偶尔连接应用程序。

Here' an article that describes how to get LINQ to SQL to work on it. 这是一篇文章 ,描述了如何使LINQ to SQL在其上运行。 Apparently you can also use LINQ to Entities on it but there's quirks (such as design-time support) that you'll have to work around. 显然,您也可以在其上使用LINQ to Entities ,但是您必须解决一些怪癖(例如设计时支持)。

SQLLite : SQLLite

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite是一个软件库,可实现自包含,无服务器,零配置的事务型SQL数据库引擎。 SQLite is the most widely deployed SQL database engine in the world. SQLite是世界上部署最广泛的SQL数据库引擎。

There's a LINQ provider for it called DBLinq As @Robert Harvey pointed out in his answer there's (almost) full support for EF since there's an ADO.NET provider for SQLLite: 有一个名为DBLinq的LINQ提供程序,正如@Robert Harvey在他的回答中指出的那样,(几乎)完全支持EF,因为有一个SQLLite的ADO.NET提供程序:

Support for the ADO.NET 3.5 Entity Framework 对ADO.NET 3.5实体框架的支持

Supports nearly all the entity framework functionality that Sql Server supports, and passes 99% of the tests in MS's EFQuerySamples demo application. 支持Sql Server支持的几乎所有实体框架功能,并通过MS EFQuerySamples演示应用程序中99%的测试。

Generally, you want to store the data from your application in a database. 通常,您希望将应用程序中的数据存储在数据库中。 For WPF and C#, that database is usually SQL Server or SQL Server Express, because Visual Studio 2008 easily integrates with those. 对于WPF和C#,该数据库通常是SQL Server或SQL Server Express,因为Visual Studio 2008可以轻松地与它们集成。

Do not use XML for this. 请勿为此使用XML。 XML is not intended to be a large scale storage medium; XML并非旨在成为大规模的存储介质。 the purpose of XML is to provide a common language for different computer systems to talk to each other. XML的目的是为不同的计算机系统相互交流提供一种通用语言。

SQL Server Express is usable on any Windows PC; SQL Server Express可在任何Windows PC上使用; you just need to deploy the redistributable, using a named instance. 您只需要使用命名实例来部署可再发行组件 See also http://msdn.microsoft.com/en-us/library/dd981032(SQL.100).aspx . 另请参见http://msdn.microsoft.com/zh-cn/library/dd981032(SQL.100).aspx If it's a small application and you want to go simpler, you can use SQL Server Compact Edition, or SQLite with the ADO.NET provider. 如果它是一个小型应用程序,并且您想变得更简单,则可以使用SQL Server Compact Edition或带有ADO.NET提供程序的 SQLite

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM