Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
647 views
in Technique[技术] by (71.8m points)

c# - Is it good idea to use uint instead of int as the primary key in data model class?

We know that the primary keys are usually positive integers.

Is it good idea to use uint instead of int as the primary key in data model class?

Example:

public class Customer
{
   public uint CustomerId {get;set;}
   //others are omitted for the sake of simplicity.
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The corresponding SQL data type is a signed number, so I'd stick with the int to avoid any surprises.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...