-1

I am making a web app, and one of the db tables holds client information and design settings for the site:

public class Client
{ 
    public string Name { get; set; }
    public string SiteName { get; set; }
    public string PrivacyStatement { get; set; }
    public bool HasLogo { get; set; }
    // some more properties
}

This table will never have more than one record, and it does not have any related tables. Is it ok to omit the PK in this case?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Stian
  • 1,522
  • 2
  • 22
  • 52

1 Answers1

0

Will the record will always be static ?

If Yes, it is absolutely fine to omit the Primary key if you are 100% sure that this table will have only one record and also do not have any relation with other tables.(Why do you even want to store it in table? Think a bit)

If NO, then also you don't need to store it in a table simply store it in a object and change it accordingly.

There is also a nice discussion on this post about primary key you can look into it.

Should each and every table have a primary key?

philipxy
  • 14,867
  • 6
  • 39
  • 83
Navin Ojha
  • 29
  • 6
  • Some of the fields in the record will be dynamic. What is this object you are referring to? An object in the database? – Stian Jun 20 '21 at 13:58