Is it better to generate guid manually in my application or let sql server / azure sql generate it for me

How to create guid for my entities in my application that will be saved by entity framework in sql azure.

I am currently using Id = Guid.NewGuid() . Is it correct?

EDIT

To clarify why I ask for this, below are my explanations

My friend told me that sql server can generate guid using "NewID ()". Right now I am creating a guid in my application using "Guid.NewGuid ()". Which one should I use? For me, my current approach is more convenient because I get the guid value even before I store it in the database. What is the top / bottom side of each approach?

+5
source share
1 answer

It really doesn't matter where you create the Guid , because it is guaranteed to be unique anyway. But people coming from the background of Domain Driven Design suggest that creating it on the C# side is the right approach, as you can use it right away without querying the database if you need to update another object using Guid .

+5
source

All Articles