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
68 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

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…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

732 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