We have a Dot net Win forms Application which has few Forms with more than 40 fields to fill.
我们有一个Dot net Win表单应用程序,其中包含少量表单,其中包含40多个字段。
When the User fills say 25 fields and then realizes that he needs to get some more data before he can save the information or He enter all the data but their is some Business validation error on which needs contact someone else before correcting.
当用户填写说25个字段,然后意识到他需要获得更多数据才能保存信息或他输入所有数据但是他们是一些业务验证错误,需要在更正之前联系其他人。
In such scenarios, he would like to save the incomplete or Incorrect data to some temporary data storage and retrieve it later when he has the data to complete the save operation.
在这种情况下,他希望将不完整或不正确的数据保存到某些临时数据存储中,并在以后有数据完成保存操作时检索它。
Please let me know what would be the best way to implement this?
请告诉我实施此操作的最佳方法是什么?
He are few options we considered:
他是我们考虑的几个选择:
-
Create XML blob and save on his local machine (But, user may need it from some other machine)
创建XML blob并保存在他的本地计算机上(但是,用户可能需要从其他计算机上获取它)
-
Create duplicate tables to store invalid data (But, I feel Invalid data should never be part of my database)
创建重复的表来存储无效数据(但是,我认为无效数据永远不应该是我的数据库的一部分)
8 个解决方案
#1
6
You could persist the partial form to XML and save the XML into a database table which also has the user id and the form identifier. When the user next brings up the form on the original machine or a different machine, the system would detect the partial data and prompt the user to reload/ignore/delete it. You would only need a single table for all forms & users. Separate tables for each database object would be unnecessary.
您可以将部分表单持久化为XML并将XML保存到数据库表中,该表还具有用户标识和表单标识符。当用户接下来在原始机器或不同的机器上调出表格时,系统将检测部分数据并提示用户重新加载/忽略/删除它。对于所有表单和用户,您只需要一个表。不需要为每个数据库对象分隔表。
#2
1
You could put all invalid data as plain text/xml field in one database table. Presumably you never need to sort/search on the incomplete data. This might combine the benefits of both your ideas.
您可以将所有无效数据作为纯文本/ xml字段放在一个数据库表中。大概你永远不需要对不完整的数据进行排序/搜索。这可能会结合您的想法的好处。
#3
1
How do you store the data when the user sends it back for validation? Do you store it in the session? Could you just save that part of the session to your database and restore it when he/she wants to finish entry?
当用户将数据发送回来进行验证时,如何存储数据?你把它存放在会话中吗?你可以将会话的那部分保存到数据库中并在他/她想要完成输入时恢复它吗?
One other thought is to split the forms up into sub sections which get saved before proceeding. A 40-field form seems kind of excessive and may also lead to a difficult-to-use application.
另一个想法是将表单拆分为子部分,然后在继续之前保存。 40字段形式似乎有点过分,也可能导致难以使用的应用程序。
#4
0
J D makes an excellent point. This user interface sounds like a job for a Wizard. That way they are 3 pages in by the time they realize they need more data, and you know that data is valid since you've been validating page by page.
J D提出了一个很好的观点。此用户界面听起来像向导的作业。这样,当他们意识到需要更多数据时,他们就是3页,而且你知道数据是有效的,因为你已经逐页验证了。
#5
0
1) the incomplete data will expire when the session expires
1)当会话到期时,不完整的数据将过期
User wants the Incomplete data be available for his login across sessions.
用户希望不完整数据可用于跨会话登录。
#6
0
I would say go with the second option but tie the incomplete data to the session that way you gain 2 things:
我会说第二个选项,但将不完整的数据绑定到会话,这样你获得两件事:
1) the incomplete data will expire when the session expires 2) there will be a clear connection which data is owned by which session(user)
1)当会话到期时,不完整的数据将到期2)将有一个明确的连接,哪个数据由哪个会话(用户)拥有
I don't think there's anything wrong with storing it in the database as long as you make sure it's periodically cleaned(in this case on session expiration). Good luck
我不认为将它存储在数据库中有任何问题,只要你确保它定期清理(在这种情况下会话到期)。祝好运
Edit: If you want it to be available across session tie it to the user and expire it when it's complete.
编辑:如果您希望它在会话中可用,请将其与用户绑定,并在完成后将其终止。
#7
0
I think it belongs in a separate table. From a business point of view it is an IncompleteWidget. When saved and validated it is stored in the Widget table.
我认为它属于一个单独的表。从业务角度来看,它是一个IncompleteWidget。保存并验证后,它将存储在Widget表中。
The mapping may seem like a bit of a pain, but I think in this situation it makes sense.
映射可能看起来有点痛苦,但我认为在这种情况下它是有道理的。
#8
0
Possibly controversial, but: store the incomplete object in the same database table you would store the completed object.
可能存在争议,但是:将不完整的对象存储在您存储已完成对象的同一数据库表中。
The incomplete and complete objects are of exactly the same class of entity and are merely at different stages in their lives. You can use a status field to indicate whether the object has been validated yet. This solves the problem without introducing a whole new mechanism to debug and maintain.
不完整和完整的对象具有完全相同的实体类别,并且仅处于其生活的不同阶段。您可以使用状态字段指示对象是否已经过验证。这解决了这个问题,而没有引入一个全新的机制来进行调试和维护。
#1
6
You could persist the partial form to XML and save the XML into a database table which also has the user id and the form identifier. When the user next brings up the form on the original machine or a different machine, the system would detect the partial data and prompt the user to reload/ignore/delete it. You would only need a single table for all forms & users. Separate tables for each database object would be unnecessary.
您可以将部分表单持久化为XML并将XML保存到数据库表中,该表还具有用户标识和表单标识符。当用户接下来在原始机器或不同的机器上调出表格时,系统将检测部分数据并提示用户重新加载/忽略/删除它。对于所有表单和用户,您只需要一个表。不需要为每个数据库对象分隔表。
#2
1
You could put all invalid data as plain text/xml field in one database table. Presumably you never need to sort/search on the incomplete data. This might combine the benefits of both your ideas.
您可以将所有无效数据作为纯文本/ xml字段放在一个数据库表中。大概你永远不需要对不完整的数据进行排序/搜索。这可能会结合您的想法的好处。
#3
1
How do you store the data when the user sends it back for validation? Do you store it in the session? Could you just save that part of the session to your database and restore it when he/she wants to finish entry?
当用户将数据发送回来进行验证时,如何存储数据?你把它存放在会话中吗?你可以将会话的那部分保存到数据库中并在他/她想要完成输入时恢复它吗?
One other thought is to split the forms up into sub sections which get saved before proceeding. A 40-field form seems kind of excessive and may also lead to a difficult-to-use application.
另一个想法是将表单拆分为子部分,然后在继续之前保存。 40字段形式似乎有点过分,也可能导致难以使用的应用程序。
#4
0
J D makes an excellent point. This user interface sounds like a job for a Wizard. That way they are 3 pages in by the time they realize they need more data, and you know that data is valid since you've been validating page by page.
J D提出了一个很好的观点。此用户界面听起来像向导的作业。这样,当他们意识到需要更多数据时,他们就是3页,而且你知道数据是有效的,因为你已经逐页验证了。
#5
0
1) the incomplete data will expire when the session expires
1)当会话到期时,不完整的数据将过期
User wants the Incomplete data be available for his login across sessions.
用户希望不完整数据可用于跨会话登录。
#6
0
I would say go with the second option but tie the incomplete data to the session that way you gain 2 things:
我会说第二个选项,但将不完整的数据绑定到会话,这样你获得两件事:
1) the incomplete data will expire when the session expires 2) there will be a clear connection which data is owned by which session(user)
1)当会话到期时,不完整的数据将到期2)将有一个明确的连接,哪个数据由哪个会话(用户)拥有
I don't think there's anything wrong with storing it in the database as long as you make sure it's periodically cleaned(in this case on session expiration). Good luck
我不认为将它存储在数据库中有任何问题,只要你确保它定期清理(在这种情况下会话到期)。祝好运
Edit: If you want it to be available across session tie it to the user and expire it when it's complete.
编辑:如果您希望它在会话中可用,请将其与用户绑定,并在完成后将其终止。
#7
0
I think it belongs in a separate table. From a business point of view it is an IncompleteWidget. When saved and validated it is stored in the Widget table.
我认为它属于一个单独的表。从业务角度来看,它是一个IncompleteWidget。保存并验证后,它将存储在Widget表中。
The mapping may seem like a bit of a pain, but I think in this situation it makes sense.
映射可能看起来有点痛苦,但我认为在这种情况下它是有道理的。
#8
0
Possibly controversial, but: store the incomplete object in the same database table you would store the completed object.
可能存在争议,但是:将不完整的对象存储在您存储已完成对象的同一数据库表中。
The incomplete and complete objects are of exactly the same class of entity and are merely at different stages in their lives. You can use a status field to indicate whether the object has been validated yet. This solves the problem without introducing a whole new mechanism to debug and maintain.
不完整和完整的对象具有完全相同的实体类别,并且仅处于其生活的不同阶段。您可以使用状态字段指示对象是否已经过验证。这解决了这个问题,而没有引入一个全新的机制来进行调试和维护。