Entity Framework: Foreign Keys and Relationships - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Friday, July 6, 2018

Entity Framework: Foreign Keys and Relationships

Foreign key In the context of relational databases, a foreign key is a column or combination of columns in one table that uniquely identifies a row of another table in order to establish and enforce a link between the data in two tables. In simpler words, the foreign key is defined in a second table, but it refers to the primary key in the first table. For example, a table called Customer has a primary key called CustomerID. Another table called Order has a foreign key which references CustomerID in order to uniquely identify the relationship between both the tables. Relationships There are three types of relationships: one-to-one, one-to-many, and many-to-many. In a one-to-many relationship, the foreign key is defined on the table that represents the many end of the relationship. The many-to-many relationship involves defining a third table (called a junction or join table), whose primary key is composed of the foreign keys from both related tables. In a one-to-one relationship, the primary key acts as a foreign key and there is no separate foreign key column for either table.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

Better code,Entity Framework

No comments:

Post a Comment