如何为测验引擎创建架构?

发布于 2024-12-09 02:13:19 字数 1108 浏览 1 评论 0原文

我正在开发一个测试工具,它将包括不同的问题模块/类别,并允许不同的问题/问题类型(即多项选择、音频多项选择、音频加表格等)。测试(测验)将包括具有可变数量选择的多项选择题。

以下是我的初始架构:

Category(Id, Name)

Question (Id, CategoryId)

MultipleChoiceQuestion (Id, QuestionId, Text)

MultipleChoiceWithAudioQuestion (Id, QuestionId, Text, AudioFile, Transcript)

AudioQuestion (Id, QuestionId, AudioFile, Transcript)

Answer (Id, QuestionId, Correct)

MultipleChoiceAnswer (Id, AnswerId, Text)

AudioQuestionAnswers (Id, AnswerId, Field, Value)

Test (Id, UserId, TestDate)

TestQuestions (Id, TestId, QuestionId)

TestAnswers (Id, TestId, QuestionId, AnswerId)

我认为允许不同问题/问题类型的最佳方法是为每个子类型创建一个表,其中包含特定于该问题类型的附加字段。我从这篇关于数据建模的文章中得到了这个想法: 逻辑数据中的类型、子类型和类别模式建模

测试由不同的类别组成,每个类别将由该特定类别中随机选择的问题组成。用户进行的每个测试都会保存到数据库中。

你认为我走在正确的道路上吗?我如何使用像 EntityFramework 这样的 ORM 将表映射到类。

我想到的另一个模式对我来说似乎太通用并且难以查询。

Content (Id, Name)

ContentMeta (Id, ContentId, MetaKey, MetaValue)

我将如何显示分层复合类型的测试?是否仍然可以在 ASP .NET MVC 3 (Razor) 中使用模型绑定。

I am developing a testing tool that will include different modules/categories of questions and will allow for different question/problem types (i.e. multiple choice, multiple choice with audio, audio plus a form, others) . A test(quiz) will include multiple choice questions with a variable number of choices.

Below is my initial schema:

Category(Id, Name)

Question (Id, CategoryId)

MultipleChoiceQuestion (Id, QuestionId, Text)

MultipleChoiceWithAudioQuestion (Id, QuestionId, Text, AudioFile, Transcript)

AudioQuestion (Id, QuestionId, AudioFile, Transcript)

Answer (Id, QuestionId, Correct)

MultipleChoiceAnswer (Id, AnswerId, Text)

AudioQuestionAnswers (Id, AnswerId, Field, Value)

Test (Id, UserId, TestDate)

TestQuestions (Id, TestId, QuestionId)

TestAnswers (Id, TestId, QuestionId, AnswerId)

I thought that the best way to allow for different question/problem types was to create a table for each subtype which would contain the additional fields particular to that question type. I got this idea from this article on data modeling: Type, Subtype, and Category Patterns in Logical Data Modeling

A test consists of different categories and each category will consist of a random selection of questions in that particular category. Each test that is taken by a user is saved to the database.

Do you think I'm on the right track? How would I map my tables to classes using an ORM like EntityFramework.

Another schema I thought of seemed to me to be too generic and difficult to query.

Content (Id, Name)

ContentMeta (Id, ContentId, MetaKey, MetaValue)

How would I display the Test which is a hierarchical composite type? Would it still be possible to use Model Binding in an ASP .NET MVC 3 (Razor).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

饮湿 2024-12-16 02:13:19

怎么样:

调查
ID
姓名
描述

问题类型
ID
姓名
描述

问题
ID
问题类型ID
显示

调查有问题,问题有类型。当谈到存储答案时,那就是另一回事了。如果您将有数以万计的响应,并且必须临时查询该数据,那么我会编写动态 SQL 来为每个调查创建一个表,否则我会将响应存储在一个单独的数据表中。桌子。

How about:

Survey
Id
Name
Description

QuestionType
Id
Name
Description

Question
Id
QuestionTypeId
Display

Survey has questions and questions have types. When it comes to storing answers, that's a different story. If you are going to have tens of thousands of responds and you'll have to query that data ad-hoc, then I'd write dynamic SQL to create a table for each of your surveys, otherwise I'd store responses in a single table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文