Questions about using the GUID type instead of int

Asked

Viewed 231 times

0

I see many models of systems on the net where Id fields are set with GUID type instead of INT, as in the example below:

public class Product
{
    public Guid Id { get; protected set; }
    public string Name { get; protected set; }
    public int Quantity { get; protected set; }
    public DateTime Created { get; protected set; }
    public DateTime Modified { get; protected set; }
    public bool Active { get; protected set; }
}

  • What is the advantage of using GUID instead of INT?
  • This may impair the performance of the App and/or database?
  • I have a commercial system that is still being designed... If I use GUIDS instead of INTS in my tables, this would be recommended?

A hug to all!

1 answer

0

Guid in a simple way is a structure that represents an integer of 128 bits (16 bytes), allowing representing 3.4028237*10 38 values. A int depending on the system is represented by 32 bits (4 bytes). In my opinion it depends on the size of your database.

In this link, it is best explained:

/a/22574/104651

Browser other questions tagged

You are not signed in. Login or sign up in order to post.