TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Usama Shahid
NA
9.5k
2.3m
Specify On Delete No Action or On Update No Action
May 29 2018 1:18 PM
Hy Guys, I'm working on an ASP.Net Project. Actually I'm making my database with codefirst and building the relations between entities. But i'm getting an error on my last stage. My Entity code is,
public
class
Product
{
public
int
ProductId {
get
;
set
; }
[Required]
[StringLength(30)]
public
string
Name {
get
;
set
; }
[Required]
public
string
Description {
get
;
set
; }
public
bool
Sugar {
get
;
set
; }
public
bool
Featured {
get
;
set
; }
public
DateTime ArrivalTime {
get
;
set
; }
public
int
FoodCategoryId {
get
;
set
; }
public
FoodCategory FoodCategory {
get
;
set
; }
public
int
BrandId {
get
;
set
; }
public
Brand Brand {
get
;
set
; }
public
Guid FileDetailId {
get
;
set
; }
[ForeignKey(
"FileDetailId"
)]
public
virtual
FileDetail FileDetail {
get
;
set
; }
public
virtual
ICollection
Reviews {
get
;
set
; }
}
And my File Detail Entity Class Code is,
public
class
FileDetail
{
public
Guid Id {
get
;
set
; }
[Required]
public
string
FileName {
get
;
set
; }
[Required]
public
string
Extension {
get
;
set
; }
}
And I'm getting this error.
Introducing FOREIGN KEY constraint 'FK_dbo.Products_dbo.FileDetails_FileDetailId' on table 'Products' 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.
Can anyone help me please?
Reply
Answers (
1
)
DataTables warning: table id=dataTable - Invalid JSON respon
Store user input data into XML file