Doubts about using GUID type instead of int [duplicate]

0

I see many models of systems on the net where Id fields are defined with type GUID 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?
  • Can this damage the performance of the Application and / or database?
  • I have a commercial system that is still being designed ... If I use GUIDS instead of INTS in my tables, would this be recommended?

A hug to everyone!

    
asked by anonymous 18.04.2018 / 18:13

1 answer

0

Guid in a simple way is a structure that represents a 128-bit integer (16 bytes), allowing you to represent 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 better explained:

link

    
18.04.2018 / 18:42