Solved

Mysterious database

Posted on 2011-09-09
4
224 Views
Last Modified: 2012-06-27
Hi All,
 

I am using MVC3 with I had a  few databse tables already and I generated classes out of that. Now when I create controller out of that and try to add new records then it does create them but all those records don't even show up in the .MDF file which is there. But it saves them all somewhere else. I am not even able to figure out where does it store them. Even web.config has reference to only one databse and that is the MDF file that I am reffereing to . I am not sure where is this parallel databse coming from..

Is there anything that I am doing wrong?
.
0
Comment
Question by:TheCommunicator
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Grant Spiteri
ID: 36515930
Have to done a search for the database ie mydb.MDF on your comp to see if a duplicate comes up?
0
 

Author Comment

by:TheCommunicator
ID: 36516300
yeah, it shows only one entry
0
 
LVL 12

Accepted Solution

by:
Wouter Boevink earned 500 total points
ID: 36516409
Did you initialize your model with a connection string?
By default mvc3 looks for a conectionstring in the web.config with the same name as the model name.
If no connectionstring is found MVC3/EF4 creates a database for you, with a .sdf extension (not sure about the extension though).
0
 

Author Comment

by:TheCommunicator
ID: 36525060
Well, little correction here. By default, it looks for a connection string in the databse with the DBContext's name not the model name. Yes, that's where I was mistaken bacause it had created a DBContext class but I did not name my connection string with something that matches it.

As a result it created an MDF file with the same name and started operating from it. It was a nighmare. Thanks anyways.:).
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question