我的需求是这样的,首先我需要一个可以自定义的调查问卷,其中可以有很多问题,比如:
1. 你对我们的服务满意吗?
2. 服务员态度好吗?
3. 特色菜好吃吗?
.....(还可能有很多,今后只需要在后台编辑、添加不用再改数据库表)现在,我需要对每个用户调查,每个用户都有自己的一份上面的问卷及答案,相当于是用户表里需有一个“调查字段”,此字段就是一张调查表,当调查问卷改变后,用户表里的“调查字段”也会随之更变。如果在内存里用C#操作的话可以这样表示:
  public class Investigate
    {
       public int InvestigateId { get; set; }
       public string InvestigateName { get; set; }
       public bool Issatisfy { get; set; }
    }   public class Guest
   {
       public int GuestId { get; set; }
       public int GusetName { get; set; }
       public List<Investigate> MyFeedBack { get; set; }//这个集合应该存在数据库中的哪里呢?
   }

解决方案 »

  1.   

    调查表(id,题目,选项1,选项2,选项3,...,正确答案)
    用户表(id,用户名,调查时间,调查总结果)
    答卷表(题目id,用户id,用户答案)
    对每一个用户,每一题有一个答案,可能是单选/多选/填空/判断,用答案与调查表中的答案对比获得本用户本题结果.
      

  2.   

    题目表
    用户调查表 (userid ,试卷id)
    试卷表(试卷id,题目id,答案)
      

  3.   

    调查表(InvestigateId,InvestigateName)
    用户表(GuestId,GuestName
    试卷表(AnswerId,GuestId,InvestigateId,Answer)用EF的话对应关系如下:public   class     
            { 
                  public   int   InvestigateId   {   get;   set;   } 
                  public   string   InvestigateName   {   get;   set;   }         
            }   public   class   Answer 
          { 
                  public   int   AnswerId   {   get;   set;   } 
                  public   int   GusetId   {   get;   set;   } 
                  public   int   InvestigateId   {   get;   set;   } 
                  public   virtual Investigate Investigate {get;set;}
                  public   int   GusetAnswer   {   get;   set;   }             
          }
    public   class   Guest 
          { 
                  public   int   GuestId   {   get;   set;   } 
                  public   int   GusetName   {   get;   set;   } 
                  public   int   AnswerId   {   get;   set;   } 
                  public virtual IConnection<Answer> Answers{get;set;}
          }
      

  4.   

    谢谢大家,解决了,bbsmvc你少打了个类名
    public   class Investigate 
            { 
                  public   int   InvestigateId   {   get;   set;   } 
                  public   string   InvestigateName   {   get;   set;   }         
            }