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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:16:43+00:00 2026-06-03T04:16:43+00:00

I am working on a project where we use EF for data access and

  • 0

I am working on a project where we use EF for data access and WPF and MVVM for user interface.

I am binding a view model to the data context of a window. This view model has a default constructor defined as following:

 public KonumVM()
    {
        LocationOperations = new LocationOperations();
        LocationNames = new ObservableCollection<string>();
        Corporations= new ObservableCollection<Kurum>();
        //Corporations= LocationOperations.GetCorpValues();

        //foreach (var corp in Corporations)
        //{
        //    LocationNames.Add(corp.Name);
        //}
    }

The commented lines are where I query the database. If the lines are not commented, when I try to edit the XAML code of the window that binds to this View Model I get an exception, I think it is a XAML Load Failure, which blocks designer. The exception is at the end of the message. When I comment the database querying lines, the designer is fine, no exceptions.

What should I do? Should I move the database access code to some other place other than default constructor?

Cannot open database “DemirbaşEntityLibrary.DemirbaşContext” requested
by the login. The login failed. Login failed for user ‘Rfid\Mert’.
at
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject) at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection) at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) at
System.Data.SqlClient.SqlConnection.Open() at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)

  • 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-03T04:16:44+00:00Added an answer on June 3, 2026 at 4:16 am

    The solution came by moving my context binding code to code-behind file, so XAML parser does not try to access DB while I am designing the UI.

    this.DataContext = new MyViewModel();
    

    If you don’t like the code-behind approach (for some reason), you can move it back to your XAML code when you finish designing UI.

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

Sidebar

Related Questions

I'm working on a project in C#, it's about E-learning.This project should use plug-ins
I'm working on a web based project where we make use of the user's
I'm working on a WinForm application. I've implemented data-access logic into a library project
The project I'm working on uses straight JDBC data access in all its boilerplate
I am working on an n-tier web project, The data access layer is in
I am working on project where I have to access SharePoint data in C#.
I'm currently working on a project which uses many ajax requests to access data
I'm working on a project where we use Hibernate and JBoss 5.1. We need
I'm working with a project where I use GWT. There's no problems with it,
I'm currently working on a project where I use Zend Framework with Propel. I'm

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.