Need help with app design

So, I would like to receive feedback in order to best develop classes and save data for the following situation:

I have an interface called "Tasks" that looks like this:

interface ITask
{
    int ID{ get; set;}
    string Title {get; set;}
    string Description{get; set;}
}

I need the ability to create different types of tasks depending on who uses the application ... for example:

public class SoftwareTask: ITask
{
    //ITask Implementation
    string BuildVersion {get; set;}
    bool IsBug {get; set;}

}

public class SalesTask: ITask
{
    //ITask Implementation
    int AccountID {get; set;}
    int SalesPersonID {get; set;}
}

So, as I see it, I can create a task table in the database with columns that correspond to the ITask interface and a column that drags all the properties of more specific tasks into one column (or maybe even serializes the task object into one column)

OR

Create a table for each type of task to preserve properties unique to that type.

- . ( ), , , , .

Plug-In , , .

.

+3
2

( ) - , , ORM (, EntityFramework NHibernate).

, , , , " ".

№1: .. , , () , , . :

TaskExt Table
=================
TaskID     : Number (foreign key back to Task)
FieldType  : Number or String (this would be AccountID, SalesPersonID, etc)
FieldValue : String  (this would be the value of the associated field)

№2: .. (, , / ..). , DATA01, DATA02, DATA03... . . , DATA01 BuildVersion SoftwareTask AccountName SalesTask. -, , . :

TaskExt Table
=================
TaskID   : Number  (foreign key back to task)
Data01   : String
Data02   : String
Data03   : String
Data04   : String
Data05   : Number
Data06   : Number
Data07   : Number
Data08   : Number
Data09   : Date
Data10   : Date
Data11   : Date
Data12   : Date
// etc...

№1 , , , . , , . Unpivoting , .

№ 2 - , 1--1, . , . -, , , , , . , ( 50-300 ). , , datetime .. . , , DateTime, , , .

, ORM .

+3

, , ORM , TPH/TPC/TPT

, ITask - , , , TPC ( ). , TPT TPH .

+3

Source: https://habr.com/ru/post/1782668/


All Articles