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
70 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

687 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