Generating GUID

后端 未结 4 1089
囚心锁ツ
囚心锁ツ 2020-12-31 08:02

I am thinking to use a GUID in my .net app which uses SQL Server. Should I be writing a stored procedure which generates the GUID on each record entered or should I be direc

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 08:26

    My preference is to create GUID in the application not the db.

    • Simplifies the retrieval of rows after insertion.
    • Easier domain/business layer unit testing.
    • Faster. At least for entity framework. http://blogs.msdn.com/b/adonet/archive/2010/06/28/performance-impact-of-server-side-generated-guids-in-ef.aspx

提交回复
热议问题