vendredi 28 novembre 2014

Multiple Cycle on Code First Approach Entity Framework


Vote count:

0





public class Admission
{
[Required]
public int AdmissionId { get; set; }

[Required]
public int SscInformationId { get; set; }

[Required]
public int HscInformationId { get; set; }

public SscInformation SscInformation { get; set; }

public HscInformation HscInformation { get; set; }
}

public class HscInformation
{
[Required]
public int HscInformationId { get; set; }

[Required]
public int EducationBoardId { get; set; }

[Required]
public int RollNumber { get; set; }

[Required]
public int PassingYear { get; set; }

public EducationBoard EducationBoard { get; set; }
}

public class SscInformation
{
[Required]
public int SscInformationId { get; set; }

[Required]
public int EducationBoardId { get; set; }

[Required]
public int RollNumber { get; set; }

[Required]
public int PassingYear { get; set; }

public EducationBoard EducationBoard { get; set; }
}

public class EducationBoard
{
[Required]
public int EducationBoardId { get; set; }

[Required(ErrorMessage = "Education Board Name is required.")]
[Display(Name = "Education Board Name")]
public string EducationBoardName { get; set; }
}


This is my Data Model. When i try to create database using code first approach in entity framework, It gives me following error:



Introducing FOREIGN KEY constraint 'FK_dbo.SscInformations_dbo.EducationBoards_EducationBoardId' on table 'SscInformations' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint or index. See previous errors.



How can i solve this ??



asked 1 min ago







Multiple Cycle on Code First Approach Entity Framework

Aucun commentaire:

Enregistrer un commentaire