c# .net questions if false explain why T/F - Entity Framework is the only way to
ID: 3712017 • Letter: C
Question
c# .net questions if false explain why
T/F - Entity Framework is the only way to interact with a database using C#
2.
T/F – Entity Framework allows for async access to the database.
3.
T/F - Using another tables Primary Key as an attribute in a table automatically creates a Foreign Key in the database.
4.
One downside of letting the database automatically assign a number as the primary key for a table is that it doesn't not prevent otherwise ___________ entries from being added to the table.
5.To represent a Many-to-Many relationship in a relational database, you should create a _______ table that has one-to-many relationships with both tables
Explanation / Answer
1.
T/F - Entity Framework is the only way to interact with a database using C#
False
There are multiple ways to connect with data base under .net framework and Entity Framework just one of the way.
ADO.Net: This is the basic approach but here efforts are more as it requires manual coding. And while using this approach there are few things need to be taken care such as, setting up the database connections, opening and closing the connection at the right time, creating commands and provide parameters to commands, and execute commands. And once we get the result post executing the respective, the mapping of result need to be done manually.
Entity Framework: This built on top of the ADO.NET Framework. But it's heavy as it provides lot of features with out writing a single line of code.
2.
T/F – Entity Framework allows for async access to the database.
True
This feature is only supported by "Entity Framework 6" onwards . And the latest version of EF is "EF 6.1.2".
3.
T/F - Using another tables Primary Key as an attribute in a table automatically creates a Foreign Key in the database.
True
With the help of Data Annotation available under the namespace "System.ComponentModel.DataAnnotations" and by adding the ForeignKey attribute in the respective table where the need to create it.
For an example, [ForeignKey("Mention Respective Primar Key Column Name Here")].
4.
One downside of letting the database automatically assign a number as the primary key for a table is that it doesn't not prevent otherwise duplicate entries from being added to the table.
Advantages of Having Primary Key in a Table
Disadvantages of Having Primary Key in a Table
5.To represent a Many-to-Many relationship in a relational database, you should create a associattive table that has one-to-many relationships with both tables
False
There are multiple ways to connect with data base under .net framework and Entity Framework just one of the way.
ADO.Net: This is the basic approach but here efforts are more as it requires manual coding. And while using this approach there are few things need to be taken care such as, setting up the database connections, opening and closing the connection at the right time, creating commands and provide parameters to commands, and execute commands. And once we get the result post executing the respective, the mapping of result need to be done manually.
Entity Framework: This built on top of the ADO.NET Framework. But it's heavy as it provides lot of features with out writing a single line of code.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.