构造代表Rubric的对象的正确方法是什么

时间:2021-11-07 10:49:15

I have a Rubric entity that I need to represent in my application. I have created an implementation but unfortunately my gut feels like the data structure I've created is flawed (for example I cant see a 'good' way to represent it relationally).

我有一个Rubric实体,我需要在我的应用程序中表示。我已经创建了一个实现,但遗憾的是我的直觉感觉就像我创建的数据结构存在缺陷(例如,我无法看到一种'良好'的方式来表示它的关系)。

Note that the functionality of the data structure must allow for an arbitrary amount of columns (and column headings) to be added to the rows.

请注意,数据结构的功能必须允许将任意数量的列(和列标题)添加到行中。

Basically I have 2 questions, firstly is there some way to structure this object so that it can be persisted relationally to a standard SQL database or is serialization my preferred option?

基本上我有两个问题,首先是有一些方法来构造这个对象,以便它可以与标准SQL数据库保持关系,或者序列化是我的首选选项吗?

Secondly is there a better approach to representing this structure than what I have used regardless of the answer to the first question? I'm pretty sure there is and I just can think of it...

其次,有没有比我使用的更好的方法来表示这个结构而不管第一个问题的答案是什么?我很确定有,我只能想到它......

Thanks in advance for any input

提前感谢任何输入

构造代表Rubric的对象的正确方法是什么

My current representation. Which will be mapped back to a C# class (I'm just building the client side first)

我目前的代表。哪个将被映射回C#类(我只是首先构建客户端)

var Data = {
    ColumnsHeaders: [{ name: "Beginning", value: 1 },
                        { name: "Developing", value: 2 },
                        { name: "Accomplished", value: 3 },
                        { name: "Examplary", value: 4}],
    Rows: [{
        Description: "Stated Objective or Performance",
        Columns: [{ text: "Description of identifiable performance characteristics reflecting a beggining level of performance", value: 1 },
                    { text: "Description of identifiable performance characteristics reflecting movement toward a mastery of performance", value: 2 },
                    { text: "Description of identifiable performance characteristics reflecting a mastery of performance", value: 3 },
                    { text: "Description of identifiable performance characteristics reflecting a high level of performance", value: 4}]
    }]
};

1 个解决方案

#1


1  

Answering your second question, how about a structure like this?

回答你的第二个问题,这样的结构怎么样?

var rows = [
  {
    name: 'Stated Objective or Performance'
    columns: [
      {
        name: 'Beginning',
        value: 1,
        text: 'Lorem ipsum dolor...'  
      },
      {
        name: 'Developing',
        value: 2,
        text: 'Lorem ipsum dolor...'
      }
    ]
  },
  {
    // another row
  }
];

#1


1  

Answering your second question, how about a structure like this?

回答你的第二个问题,这样的结构怎么样?

var rows = [
  {
    name: 'Stated Objective or Performance'
    columns: [
      {
        name: 'Beginning',
        value: 1,
        text: 'Lorem ipsum dolor...'  
      },
      {
        name: 'Developing',
        value: 2,
        text: 'Lorem ipsum dolor...'
      }
    ]
  },
  {
    // another row
  }
];