繁体   English   中英

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

[英]What is the correct way to structure an object representing a Rubric

我有一个需要在应用程序中表示的Rubric实体。 我已经创建了一个实现,但是不幸的是,我的直觉感觉到我创建的数据结构存在缺陷(例如,我看不到用一种“好的”方式来表示它)。

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

基本上,我有2个问题,首先是有某种方法可以构造该对象,以便可以将其与标准SQL数据库相关地保存,还是序列化是我的首选?

其次,与第一个问题的答案无关,有没有比我使用的方法更好的方法来表示这种结构? 我很确定有,而且我可以想到...

预先感谢您的任何投入

专栏

我目前的代表。 它将被映射回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}]
    }]
};

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

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
  }
];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM