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 9067887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:03:17+00:00 2026-06-16T17:03:17+00:00

Trying to add a Controller with scaffolding and getting an error. Seems to have

  • 0

Trying to add a Controller with scaffolding and getting an error. Seems to have to do with my Connection String.

"unable to retrieve metadata for DOTNETMEMBER.Song. Failed to set database initializer type of type DOTNET.DataContextInitializer, DOTNETMEMBER' specified in the application configuration. Entries should be in the form of 'key=DatabaseInitializerForType MyNamespace.MydbContextClass, MyAssembly'. The initializer class must have parameterless constructor. See inner exception for details.

Here’s my connection string

  <connectionStrings>
    <add name="DataContext"
         connectionString="Data Source=|DataDirectory|RTDOTNETMEMBER.sdf"
         providerName="System.Data.SqlServerCe.4.0" />
  </connectionStrings>

  <appSettings>
    <add key="webpages:Version" value="1.0.0.0"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    <!--Used to initialize the database-->
    <add key="DatabaseInitializerForType DOTNET.DataContext, DOTNETMEMBER" value="DOTNET.DataContextInitializer, DOTNETMEMBER" />
  </appSettings>

Is it because of SQL Compact?

  • 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-16T17:03:18+00:00Added an answer on June 16, 2026 at 5:03 pm

    I’m afraid this isn’t a comprehensive answer because I don’t fully understand the reasons why, but when I ran into the same issue this workaround allowed me to just get on with things and stop scratching my head:

    1. Go into Web.config and comment out the line containing the DatabaseInitializerForType key (shortcut: place your cursor on the line then ctrl-K and ctrl-C).
    2. Build the project (ctrl-shift-B)
    3. Add your controller scaffolding as normal.
    4. Uncomment the initializer key in Web.config (ctrl-K, ctrl-U).

    Yes, it’s a bit of a random-stab-in-the-dark approach, but I’ll leave it here in case it helps anyone else googling the same issue!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple class called Applicant. I'm trying to add a template controller
I'm trying to add a constraint to a controller . I may have this
Im trying add roles to a drop dropdown box but im getting the error
I'm trying to add controller to my Todo list app. Here's the code. $(function(){
I'm trying to add some navigation controller in my app, it's sth likes: in
I'm trying to add a UINavigationController to my existing view controller by adding this
I am currently trying to add some parsing methods to a controller method in
I'm trying to add a custom action to a core controller by extending it
I'm trying to add a new controller with the following template specified: MvcScaffolding: Controller
I'm trying to add a custom action to Devise's registration controller which allows users

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.