Solved

Mysterious database

Posted on 2011-09-09
4
223 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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