When should I treat the primary key as classes ?
Should we only represent primary keys as classes when a table uses a composite key?
For instance:
public class PrimaryKey { ... ... ...}
Then
private PrimaryKey _parentID; public PrimaryKey ParentID { get { return _parentID; } set { _parentID = value; } }
and
public void Delete(PrimaryKey id) {...}
When should you consider saving data as comma-separated values in a column of a database table, rather than storing them in different columns?
When should I consider representing the table-id columns as classes?
It's much harder to answer without knowing the application architecture. If you use ORM like nhibernate or linq in sql, they will automatically create classes for you.
In the general case, if your primary key is composite and makes sense in your domain, create a class for it.
, .
, ( , , , ). , , - , , .
When should I consider storing data as comma-separated values in a column in a DB table rather than storing them in different columns?.
When should I consider storing data as comma-separated values in a column in a DB table rather than storing them in different columns?
. normalized, . - , SQL.
table-id ?
?
, , , ?
, ( ), (.. , , ) .
"" RDBMS: , // (-), , , .
- . SQL -.
, 12 - , (-), 12 ; : , > 100 000,00 . "" 12 , , , .
, "" ... - .
, . : OPTION A OPTION B OPTION B OPTION C, . "B, C" "B C", , .
, , " ", OR/M , .
At first, not sure what you are looking for. I create business objects as classes that map to my data layer, which is usually data containing data.
The second question is never. There are very few situations where I will keep a comma-separated list instead of creating a normalized data structure.
Source: https://habr.com/ru/post/1735884/More articles:Where to put xUnit tests to build F #? - tddD (Tango) can read and write ANSI files? - fileImplementing autocomplete in iPhone UITextField for contacts in the address book - iphoneHooks ... exactly what they are - phpApplication Model / MVC - event-handlinghttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1735885/export-visio-macros-to-visio-com-add-in&usg=ALkJrhiDSrn7ZLRTV0sSSgt0UXo9IgkmIADataSet with many OR clauses - sqlDrupal: how to upgrade the current project website to dev version? - drupalHow to debug unreleased COM links from managed code? - debuggingIn XHTML / HTML, which elements have semantic meaning, which are biased and which do not fall into both categories? - htmlAll Articles