簡體   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