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
65 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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.
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.

860 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