Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8781167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:13:49+00:00 2026-06-13T20:13:49+00:00

I have a wpf project, with the structure below: project1(solution) |->Model(project) |->DataAccess(project) |->project1(project) Project1

  • 0

I have a wpf project, with the structure below:

project1(solution)
|->Model(project)
|->DataAccess(project)
|->project1(project)

Project1 is the project where I compile and deliver the exe to the user.

Now I want to enable automatic migration: Enable-Migrations –EnableAutomaticMigrations

project1 is the default project. When I run the command, obviously it won’t be able to find the database context, which is located in the DataAccess project. I am able to enable it in the DataAccess project.

But is it correct? How can I enable it in the project1 project?


EDITED:

I think I can enable migration in the DataAccess project, and have it MyConfiguration reference back to DataAccess project?

Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyContext, MyConfiguration>());

But I get this error:

Error   2   'DataAccess.Migrations.Configuration' is inaccessible due to its protection level
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:13:50+00:00Added an answer on June 13, 2026 at 8:13 pm

    Have you tried using the -StartupProjectName parameter?

    Enable-Migrations -EnableAutomaticMigrations -ProjectName DataAccess -StartupProjectName project1

    The last parameter specifies to emulate running within that project, including any settings from app.config/web.config.

    Edit: as for enabling migrations, the error you’re seeing is probably because the MigrationsConfiguration is created by default as internal. You can either:

    • Make it public
    • Set the DB initializer somewhere in the DataAccess project
    • Set it in the app.config/web.config for project1. Even though the type is internal, it will resolve at runtime and still work:

      <entityFramework>
        <contexts>
          <context type="DataAccess.FooContext, DataAccess">
            <databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[DataAccess.FooContext, DataAccess], [DataAccess.Migrations.Configuration, DataAccess]], EntityFramework, PublicKeyToken=b77a5c561934e089">
            </databaseInitializer>
          </context>
        </contexts>
      </entityFramework>
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scene in my WPF project with about 2000 different user controls:
I have a Solution with multiple projects. One project is my DataAccess project with
I have WPF application project and I'm using EF. I want something like this.
I have a WPF user control inside windows form project and I have a
I have pretty much finished my first WPF project after several weeks. Now I
We have a WPF Project that follows the MVVM pattern. In the View Model
In my WPF Project I have a WPF Window. I want to use Sticky
I have a WPF Application project with several project references within a single solution
I have created the WPF user control and WPF window in class library project.
I have a WPF project which compiles just fine. However, when I enable code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.