本文介绍了如何保存半完成的表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展一个项目,我们希望让用户能够保存他们完成的一半表单,以便他们稍后回来完成它.我正在努力弄清楚我想如何做到这一点.我是否将它们与已完成的应用程序保存在同一个池中,仅具有特殊状态?我真的不想牺牲已完成的应用程序的完整性,因为当我不希望它们可以为空时,必须使字段可以为空.

I am working on a project where we would like to give the user the ability to save their half-completed form so they can come back later and complete it. I'm struggling with figuring out exactly how I want to do this. Do I save them in the same pool with the completed applications, only with a special status? I don't really want to sacrifice the integrity of the completed applications by having to make fields be nullable when I don't want them to be.

我是否应该在不同的架构中创建相同的数据库结构来保存不完整的应用程序?我可以让这个其他架构在数据库约束和可为空字段上更加宽松,以解决不完整的应用程序.

Should I create the same database structure in a different schema to hold the incomplete applications? I could have this other schema be more lax on the database contraints and nullable fields to account for incomplete applications.

有没有更简单的方法来做到这一点?有没有办法可以只保存视图状态并在以后恢复它?

Is there an easier way to do this? Is there a way I can just save the viewstate and restore that at a later time?

感谢您的建议!

推荐答案

您完成的申请与这些一半"状态之间可能存在一些差异:

There may be a couple of differences between your completed applications and these "half" states:

  1. 如您所说,大多数验证都是不合适的,字段将为空,交叉验证可能无法执行.
  2. 您可能不需要跨数据的任意搜索功能.

所以我会使用不同的数据库,记录包含几个关键字段,例如用户 ID、日期、他们填写的表单类型等,以及一个blob他们填写的领域.我是一个 Java 人,所以我不知道获取 blob 的 .NET 方式,但在 Java 中我可以序列化支持表单的数据对象.

So I'd use a different database, with the record comprising a few key fields such as the User's Id, the date, the kind of form they are filling etc. and a blob of the fields they have filled. I'm a Java guy so I don't know the .NET way to get the blob, but in Java I could serialise the data objects backing the form.

似乎在 C# 中的技术与 Java 有一些相似之处,至少我是这样理解的 文章 正确.

It seems like in C# the techniques have some similarity with Java, at least is I understand this article correctly.

如果不存在标准的 .Net 技术,我认为手工编写一些简单的saveAsAString"和readFromString"代码会有点乏味但非常可行.

I would think that hand-crafting some simple "saveAsAString" and "readFromString" code would be a little dull but pretty doable if no standard .Net techniques exist.

这篇关于如何保存半完成的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 20:01