是否需要序列号?

编程入门 行业动态 更新时间:2024-10-12 01:32:53
本文介绍了是否需要序列号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用一个winform(.NET)应用程序,其中包括订单,发票,服务订单,票务等。

I am working on a winform (.NET) application which includes Orders, Invoices, Service Orders, Ticketing etc.

这些enities需要顺序何时编号? IMO号以订单为例,一旦通过业务层,只能有效,在此过程中,可以创建另一个订单,批准并保存为2,而先前创建的ID为1的订单失败的验证。

It it necessary for these enities to be sequential when numbering their IDs? IMO no. Take an order for instance, it can only be valid once it passes thorugh the business layer, during that proocess another order could've been created, approved and saved with the number 2 while the order which was created earlier with id 1 failed validation.

这似乎打开了一个蠕虫病毒,哪个层分配了订单号,不是?

This seems to open a can of worms as to which layer assigns the order number, no?

目前,我使用的是前缀为实体标识符的非序列号。示例,订单使用OR-123。这是一个好主意吗?

Currently I am using non-sequential numbers prefixed with an identifier for the entity. Example, order uses OR-123. Is this a good idea?

谢谢

数据库范围SQL Server中唯一但简单的标识符

推荐答案

根据我的经验美国的现成会计制度和会计制度,会计师或审计师不需要连续的数字。需要说明的是控制和审计能力。如果一个项目被删除,则必须有一个跟踪。删除的项目的检测没有被缺少的数字跟踪 - 毕竟,还有其他类型的篡改需要连续的数字,并且足够的控制的演示远远超过了。

In my experience with off-the-shelf and bespoke accounting systems in the US, sequential numbers are not required by accountants or auditors. What is required is a demonstration of controls and auditing capability. If an item is deleted, there has to be a trail. The detection of a deleted item is not tracked by a missing number - after all, there are other kinds of tampering to get around requiring sequential numbers, and a demonstration of adequate controls goes far beyond that.

但是,我在墨西哥看到了这个要求,要从该省报销。我相信他们使用它来避免向国家机构多次提交的欺诈行为。 IMO,它不是一个有效的内部控制,并且在第三方交互情况下捕获欺诈的范围有限。

However, I have seen such a requirement in Mexico for reimbursement from the governent. I believe they use it to avoid fraud for multiple submissions to the state agency. IMO, it's not an effective internal control, and has limited scope for catching fraud in the third-party interaction situation.

一般来说,使用增加的整数ID(如IDENTITY )(或GUID - 但正常的GUID不会像这样增加)作为表中的代理主键,并且有助于提高SQL Server性能。请注意,IDENTITY值可能被用尽,但事务失败或回滚,留下空白。这个差距通常不会被填入(尽管可以通过使用身份插入)。

In general, using an increasing integer id (like IDENTITY) (or GUID - but normal GUIDs are not increasing like that) as a surrogate primary key in tables and clustering on that helps improving SQL Server performance. Note that it is possible for an IDENTITY value to be used up but a transaction to fail or be rolled back, leaving a gap. This gap will not be normally filled in (although it could be by using identity insert).

这里有一些COMB ID链接:

Here's some COMB ID links:

jeffreypalermo/blog/use-guid-comb-in-your-database-if-you-need-guid-按键但不要想要大的性能命中/

www.informit/articles/article.aspx?p=25862

我们实际上对它进行了一些修改,将其与CSLA一起使用,并将其称为SmartGUID。 SmartGUID类暴露了创建日期属性。不幸的是,我不再隶属于该项目或公司,所以我无法访问源代码来准确回忆我们的技术。

We actually modified it a little, used them with CSLA and called them SmartGUIDs. The SmartGUID class exposed a creation date property. Unfortunately, I'm no longer affiliated with that project or company, so I don't have access to the source code to recall our technique exactly.

更多推荐

是否需要序列号?

本文发布于:2023-10-29 00:58:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538237.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:序列号

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!