exam questions

Exam 70-487 All Questions

View all questions & answers for the 70-487 exam

Exam 70-487 topic 1 question 75 discussion

Actual exam question from Microsoft's 70-487
Question #: 75
Topic #: 1
[All 70-487 Questions]

You are developing an ASP.NET Core web application by using an Entity Framework code-first approach. The application uses an Azure SQL Database. The code-first migration is configured to run as part of a continuous integration build.
You must add an Azure MySQL Database. This database must use the same schema as the existing Azure SQL Database instance.
You need to configure the migration to ensure that the existing TFS build definition remains unchanged.
What are two possible ways to achieve this goal? Each correct answer presents a complete solution.
Each correct selection is worth one point.
NOTE:

  • A. Use the ActiveProvider property to specify the provider to which the migration is applied.
  • B. Create a new type that derives from DbContext and override the ActiveProvider object. Then, add or apply migrations using this type.
  • C. Use the Entity Framework Core Fluent API to identify database providers.
  • D. Create a separate Migration Assembly than the one containing the DbContext and switch the active provider during build.
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️
References:
https://medium.com/@rc_dos_santos/how-configure-asp-net-core-web-api-project-with-mysql-database-b7a64a247a99

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Dreamchaser1980
Highly Voted 4 years, 9 months ago
I thinks It’s A & B. D is wrong in this case because the TFS build definition remains unchanged. The answer specifies that the active provider would change during the build. A: https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers#one-migration-set “If operations can only be applied on one provider (or they’re differently between providers), use the ActiveProvider property to tell which provider is active.” B: https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers#two-migration-sets “Another approach that makes working with the tools easier is to create a new type that derives from your DbContext and overrides the active provider. This type is used at design time when adding or applying migrations.”
upvoted 6 times
...
bashirmja
Most Recent 4 years, 5 months ago
A&D is correct. https://vceguide.com/what-are-two-possible-ways-to-achieve-this-goal-94/
upvoted 2 times
...
mmk1991
5 years, 3 months ago
https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers?tabs=dotnet-core-cli
upvoted 4 times
exgam_20
5 years, 1 month ago
If you read this properly, the correct answers are B and D
upvoted 12 times
Natali
5 years ago
You need to configure the migration to ensure that the existing TFS build definition remains unchanged. how do you switch provider during build knowing that?
upvoted 2 times
...
GabF
5 years ago
I agree with exgam_20. If you open the link from mmk1991 (https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers?tabs=dotnet-core-cli) you will find: "Two migration sets (Option D) In the first approach, you generate two migrations for each model change. One way to do this is to put each migration set in a separate assembly and manually switch the active provider (and migrations assembly) between adding the two migrations. (Option B) Another approach that makes working with the tools easier is to create a new type that derives from your DbContext and overrides the active provider. This type is used at design time when adding or applying migrations."
upvoted 4 times
...
...
...
seanlim
5 years, 7 months ago
https://medium.com/@balramchavan/setup-entity-framework-core-for-mysql-in-asp-net-core-2-5b40a5a3af94
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...