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
Guest User
Tech Writer
98
42.4k
One (1) table with 3 Foreign Keys - Need to Reference
Jan 20 2020 11:43 PM
This is my tables in SQL Server with Category table and need to be reference in Product table with 3 CategoryId.
What solution should I do? especially in Entity Core..
Do I need to 2 more tables for Category with the same content?
what I did to the entity is just like the code below but I'm not sure if this is correct or not..
public class Category
{
public Guid Id { get; set; }
public string Name { get; set; }
}
public class Product
{
public Guid Id { get; set; }
public Guid CategoryId2 { get; set; }
public Guid CategoryId3 { get; set; }
public string Code { get; set; }
public string Name { get; set; }
[ForeignKey("Category")]
public Guid CategoryId1 { get; set; }
public virtual Category Category { get; set; }
}
Reply
Answers (
1
)
how to convert jqueryDate to long int?
how can i create mapping of two objects