Solved

Mysterious database

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now