F
F
FairyFox57002019-04-21 00:41:03
C++ / C#
FairyFox5700, 2019-04-21 00:41:03

How to set a GUID for an object only if it is not set?

I'm using the Entity Framework and generating keys using a GUID, but it turns out that each time I access it, I generate a new ID. Property example:
public Guid id { get; set; } = Guid.NewGuid();
How to check that it is not null and only when set the property to null?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question