使用MS SQL Identity是一种好习惯吗? [英] Is using MS SQL Identity good practice?

查看:92
本文介绍了使用MS SQL Identity是一种好习惯吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在企业应用程序中使用MS SQL Identity良好实践吗?在创建业务逻辑以及将数据库从一个迁移到另一个上不是很困难吗?

Is using MS SQL Identity good practice in enterprise applications? Isn't it make difficulties in creating business logic, and migrating database from one to another?

推荐答案

是的,它们运作良好且可靠,并且性能最佳.与不使用身份字段相比,使用身份字段的一大好处是它们可以处理多个调用方尝试保留新ID的所有复杂的并发问题.这似乎对代码来说是微不足道的,但事实并非如此.

Yes, they work very well and are reliable, and perform the best. One big benefit of using identity fields vs non, is they handle all of the complex concurrency issues of multiple callers attempting to reserve new id's. This may seem like something trivial to code but it's not.

下面的这些链接提供了一些有关身份字段的有趣信息,以及为什么应尽可能使用它们.

These links below offer some interesting information about identity fields and why you should use them whenever possible.

  1. DB:是否要使用身份列?
  2. http://www.codeproject.com/KB/database /AgileWareNewGuid.aspx?display=打印
  3. http://www.sqlmag.com/Article/ArticleID/48165 /sql_server_48165.html
  1. DB: To use identity column or not?
  2. http://www.codeproject.com/KB/database/AgileWareNewGuid.aspx?display=Print
  3. http://www.sqlmag.com/Article/ArticleID/48165/sql_server_48165.html

这篇关于使用MS SQL Identity是一种好习惯吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆