What are two possible ways to achieve this goal?

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.
NOTE: Each correct selection is worth one point.
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.

microsoft-exams

3 thoughts on “What are two possible ways to achieve this goal?

  1. As Edward said: 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 a 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.”

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.