Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I created a database model from MySQL to Visual Studio 2010. However, in the EntityObject's Create, for a table such as exam which has 9 columns, i only have two parameters (the key columns primary [id_exam], and foreign[user_id_exam]). Why could the rest be disappearing to what can i do about it?

Please help. I am totally stuck. :-(

C#
[EdmEntityTypeAttribute(NamespaceName="examModel", Name="exam")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class exam : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new exam object.
        /// </summary>
        /// <param name="id_exam">Initial value of the id_exam property.</param>
        /// <param name="user_id_user">Initial value of the user_id_user property.</param>
        public static exam Createexam(global::System.Int32 id_exam, global::System.Int32 user_id_user)
        {
            exam exam = new exam();
            exam.id_exam = id_exam;
            exam.user_id_user = user_id_user;
            return exam;
        }

        #endregion


The tables (exam) SQL code is:

SQL
CREATE TABLE IF NOT EXISTS `exam`.`exam` (
  `id_exam` INT(11) NOT NULL AUTO_INCREMENT,
  `Unit Code` VARCHAR(45) NULL DEFAULT NULL,
  `Unit Name` VARCHAR(45) NULL DEFAULT NULL,
  `Date` DATE NULL DEFAULT NULL,
  `Duration` DECIMAL(10,0) NULL DEFAULT NULL,
  `Instructions` VARCHAR(45) NULL DEFAULT NULL,
  `University` VARCHAR(45) NULL DEFAULT NULL,
  `Course` VARCHAR(45) NULL DEFAULT NULL,
  `user_id_user` INT(11) NOT NULL,
  PRIMARY KEY (`id_exam`),
  INDEX `fk_exam_user1_idx` (`user_id_user` ASC),
  CONSTRAINT `fk_exam_user1`
    FOREIGN KEY (`user_id_user`)
    REFERENCES `exam`.`user` (`id_user`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
Posted
Comments
Alexander Dymshyts 29-Oct-13 6:42am    
May be because they are null?
Wamuti 29-Oct-13 6:53am    
Is there anywhere I can check this and assign? I've never been confronted by this before. :-(
Alexander Dymshyts 29-Oct-13 7:24am    
in method CreateExam add exam.Univercity = "Name"; and see if you will be able to get univercity
Ziee-M 30-Oct-13 3:38am    
i am using EntityFramework and ADO.net since ages but i ve never faced this, however, you can add a partial class exam , and add your new constructor there, and you will never have to use that method again.
Wamuti 31-Oct-13 6:54am    
I have used it also many times and have never faced this before. I like the idea of a partial class but that would always add me more code work :-( ...I am considering to uninstall everything (Visual Studio and MySQL database) and starting over installations again. Grrrrrrrr...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900