Using Parts of GUID as ID

后端 未结 6 872
借酒劲吻你
借酒劲吻你 2021-01-18 21:40

I\'m developing an ASP .Net MVC application. One of my actions requires id as a parameter. For example:

public actionresult Detail(Guid id){
            


        
6条回答
  •  庸人自扰
    2021-01-18 22:22

    No, you need the entire GUID since there is a possibility that a subset may not be unique.

    For example:

    0c157b42-379d-41d5-b9ba-83e9df9985b2

    0c157b42-379d-41d5-b9ba-83e9df9985b3

    Notice, only the last number is different. The beginnings are both the same. You can't use the trailing end of the GUID either since there's no way to predict what part of the GUID will change when its created.

提交回复
热议问题