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
54 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
Comment Utility
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
Comment Utility
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)
Comment Utility
move or copy the DB and just create a new connection using the wizard and delete the old one ??
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
Comment Utility
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
Comment Utility
@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
Comment Utility
@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
Comment Utility
Thank you for the guidance.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

744 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

8 Experts available now in Live!

Get 1:1 Help Now