I used RNGCryptoServiceProvider to create string order identifiers, but there were 4 instances where ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@ $%^*()_- created an existing order identifier.
And that made me think ...
Why can't we just use something like:
<html> ... <p>@GenerateOrderId()</p> ... </html>
and
public string GenerateOrderId() { return "OID" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond; }
I was told that this was a bad idea, but without any explanation or reason, it was still stuck in my head. ... The reason I would like to use this is because it will always be unique.
Arrow
source share