Solved

What changes are needed in Web.config after making a  transfer of the .mdf from SQLManagement Studio to App_data folder?

Posted on 2016-07-29
7
61 Views
Last Modified: 2016-08-01
Hi Experts

I'm planning to transfer a SQL Server database (mdf) actually been managed by SQL Server Management Studio to be managed by the solution's App_Data folder and then create an EDMX data diagram.

What changes are needed in Web.config to make the app correclty runs?

Thanks in advance
0
Comment
Question by:Eduardo Fuerte
  • 4
  • 2
7 Comments
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 41735674
Why do you want to move the MDF file? You connect to the server, the server maintains the MDF, that's not your concern. Your concern is the connection. You only specify the database name in a connecion string info and where that database is, is internal knowledge of the SQL Server, not of your application.

From your description you have a totally wrong idea of several things.

When you move the data to app_data you don't win anything at all, you still will use the sql server, sql management studio is not the application running the database, it's sql server and you should know that. Mangement studio or any other client you choose as database adminstration frontend, your database is not the MDF file alone, that's just the datafile maintained by SQL Server.

If you think it'll be better performing to put data into the appdata folder than into the local folders sql server uses internally, then you have to move the MDF file via SQL Server administration, you don't first move the file in the file system on your own, that'll just make SQL Server not find it's database anymore. You move the mdf to a new location via ALTER DATABASE, or via properties of the database via SQL Server Management Studio. It'll still be the same hdd, wouldn't it?

Appdata folders are for data of desktop apps, not intended for SQL Server databases. It's not wrong to move or install there, but the default folders SQL Server uses for temp and master db can also hold further user data. When you want to have a net profit, you'd rather have a user/pallication database on a dedicated ssd on a totally different partition/drive, that also doesn't mean Appdata. Appdata is rather for smallish local data, configs, logs, such things. Look at what other software vendors put there, eg browsers store your user profile there, browsing history, favorites/bookmarks, but not your downloads and documents, they have separate system folders. Data of browser plugins is in Appdata, but not of a ASP.NET web application and not of a SQL Server.

Bye, Olaf.
0
 

Author Comment

by:Eduardo Fuerte
ID: 41735699
Hi

I'm making my mind about how to deal with using App_data for different purposes

1. To know on how it's a better approach

Recentrly I had this reply

https://www.experts-exchange.com/questions/28960256/Could-you-explain-in-what-aspects-adding-the-database-inside-App-Data-folder-is-a-better-aproach-that-maintain-it-under-SQL-Manager-Studio.html

It looks the meaning is slightly different from what you stated.

2. To solve this situation and create an EDMX diagram to be actualized so I intend to transfer the mdx to App_data
https://www.experts-exchange.com/questions/28958978/How-to-deal-with-Consider-using-Code-First-Migrations-to-update-the-database.html
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 41735711
move or copy the DB and just create a new connection using the wizard and delete the old one ??
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 41735724
I strongly disagree with what you took from these two questions and their answer.

An EDMX file is where a .NET project stores it's entity data model of a database. This is strongly related to the source files of your APS.NET web application. an MDF database file has no value at all in a .NET solution. The project type you could add to a solution is a dtabase project, which would contain mostly SQL files, no more no less. The data is not part of the solution.

So EDMX is about the application layer, it belongs more to the code and the reresentation model of data at runtime loaded to the application business logic tier. This files don't belong to each other. EDMX is mainly meta data about the data, data structures, navigational propeties. EDMX is not like stored proecedures you store at the database.

The difference between the code first approach and database first approach is what you intend to write first, the other will follow, the other will be created or altered according to what you do or change first. You can't choose to switch the one or other paradigm.

Code first approach is totally not your way of thinking as an ex Foxpro developer. You always did your database and then classes or forms, not the other way around. The code first approach is for those, who don't want to care much about the database level, who only see it as the persistence layer of the application. They rather like to care for the classes and objects living in memory at runtime.

Bye, Olaf.
0
 

Author Comment

by:Eduardo Fuerte
ID: 41735729
@Robberbaron (robr)

I guess I followed what you suggest

Step 1:
img001
Step2:
img002
I probably misconcept something... could you check?
0
 

Author Comment

by:Eduardo Fuerte
ID: 41735734
@Olaf

I'm better checking what you finally posted. I agree it's much more coherent to maintain the database
under SQLManager Studio and to create an EDMX based on this.
0
 

Author Closing Comment

by:Eduardo Fuerte
ID: 41737592
Thank you for the guidance.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

867 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

22 Experts available now in Live!

Get 1:1 Help Now