0

我正在设计一个银行系统,并且已经到了要存储帐户信息的步骤,以便在关闭系统时可以轻松检索它。

我该如何存储它?我应该在这里使用线程还是现在是使用数据库并将类与数据库链接的时候了?

4

2 回答 2

3

If you are designing a banking system, you need to have a thorough understanding of transactional integrity.

For example:

If you move money from one account to another, you do at least two steps

  1. Deduct money from one account
  2. Add that money to another account

It would be a very bad result if you completed Step 1 and then your program failed for some reason before completing Step 2.

Read about and fully understand transactions before proceeding.

Having said that...

Entity Framework provides a nice level of abstraction for data storage and allows you to manage database transactions. I suggest you look into that technology, along with how to use database transactions with Entity Framework.

于 2012-07-01T16:36:28.750 回答
1

在 sql server 或 oracle 中创建数据库... 使用 Entity 框架进行数据操作。我会建议您创建 WCF 服务(它将执行您的所有数据库事务)并在您的应用程序中使用该 wcf 服务。

如果您想让您的应用程序更好,那么我建议使用依赖注入(结构映射、ninject 或任何其他类似的......)..它将帮助您使您的代码干净、可维护和可测试..

于 2012-07-01T16:30:02.513 回答