localdb

Recreate and Reseed LocalDb Before Each Unit Test

夙愿已清 提交于 2019-11-27 13:08:07
问题 I'm attempting to write unit/integration tests for my ASP.NET Web API project and struggling to run each test in isolation. Allow me to explain. I have a *.testsettings file with deployment settings configured. Before each test run, an empty *.mdf file is deployed to the test location. Since I'm using Entity Framework Code First, I can use a database initializer to push my schema to the database and seed a particular table with 2 rows. This works great. The problem I'm facing is that the

How to prevent SQL Server LocalDB auto shutdown?

假如想象 提交于 2019-11-27 11:36:28
I'm using SQL Server 2012 Express LocalDB. Instances seem to stop automatically after 10 minutes if there is no activity on them. Is there a clean way to keep an instance running forever? The timeout is configurable via T-SQL with 'user instance timeout' option: sp_configure 'show advanced options', 1; RECONFIGURE; GO sp_configure 'user instance timeout', 5; GO The timeout is expressed in minutes and has a maximum value of 65535 . I'm pretty sure you need to restart the instance after setting it. And don't try setting it to 0 , it will just make the instance shut down immediately after

Is it normal to use LocalDb in production?

痴心易碎 提交于 2019-11-27 11:34:31
问题 I know that using LocalDb is very good and easy for developement, I wonder if it's good idea to use it in production when I host websites on IIS server? I'm asking because I wonder if it won't have any kind of speed issues in production. This is my connection string that I want to use in production Server=(LocalDB)\\v11.0;Integrated Security=SSPI;MultipleActiveResultSets=true; AttachDBFilename=|DataDirectory|ProjectDB.mdf; 回答1: LocalDB is absolutely supported in production. From the

Is there a difference between SQL Server Express (2012) and LocalDB?

这一生的挚爱 提交于 2019-11-27 11:11:42
In his excellent and popular comparision chart , ErikEJ draws a distinction between SQL Server Express 2012 , and SQL Server 2012 LocalDB . However, I can't find such a distinction anywhere else in the MSDN documentation ("LocalDB" isn't even mentioned in the official MS SS12 book or on the MSDN SQL Edition comparison page .) This leads me to suspect that Express and LocalDB aren't really two separate products as ErikEJ suggests, but rather just two different terms for the same thing (which would explain why, on this MSDN page , it is called "SQL Server 2012 Express LocalDB "). If there really

How to transfer ASP.NET MVC Database from LocalDb to SQL Server?

假装没事ソ 提交于 2019-11-27 09:30:23
问题 I created a new ASP.NET MVC 5 project in Visual Studio 2013 (Express for Web) and by default, the project uses LocalDb as its database, but how do you transfer or migrate the database to SQL Server? I want to use SQL Server for the database instead of LocalDb. But how? 回答1: Notwithstanding this question is old, the answer didn't help me so I want to share how I solved it for my self. On Server Explorer, find your ASPNet DB. Then open it using SQL Server Object Explorer. Then go and hit Schema

Unable to connect to localDB in VS2012 – “A network-related or instance-specific error occurred while establishing a connection to SQL Server…”

感情迁移 提交于 2019-11-27 08:05:05
This is strange as I'm able to connect to localDB through SSMS 2008R2 with the same connection string (" Data Source=(LocalDB)\v11.0;Integrated Security=true ") Only C# code is unable to connect, I have tried increasing login time with Connect Timeout=60 but no luck. I have also tried specifying the database Initial Catalog=<databasename> where the <databasename> is the one I have created on localdb via ssms. Any pointers as to why is this not connecting? Any chance it is because you forgot to double-escape the backslash? Did you try this: "Data Source=(LocalDB)\\v11.0;Integrated Security=true

SQL Server (localdb)\\v11.0 explained

点点圈 提交于 2019-11-27 06:13:42
I'm following Code First to an Existing Database tutorial and noticed that it suggested to connect to (localdb)\v11.0 in learning purposes. I've tried to connect to it using my SQL Management Studio and it worked. But when I've restored a DB backup it created an [DatabaseName].mdf file in my user's directory. I'm quite surprised and have following questions: What is a (localdb)\v11.0 ? Does it uses my SQL Express or SQL Compact? Does it support only databases stored in .mdf files? How can I specify path for my restore other than my user's folder? What general purposes does it serve (is it for

How can I specify that my app should start SQL Server LocalDb with a trace flag parameter?

北城余情 提交于 2019-11-27 03:32:04
问题 My application uses a LocalDb instance to store it's data. I've noticed a quirk in the way that LocalDb has allocated identifies (explained more here) which I'd like to avoid. The linked answer explains that this can be done by setting an SQL Server trace flag, and explains how to do this for "full fat" SQL Server. Is it possible to set a trace flag on LocalDb? As my application starts it on demand, could this be done through the connection string? 回答1: I have a similar problem and believe I

confusion about SQL Server Express and localdb

ⅰ亾dé卋堺 提交于 2019-11-27 03:08:52
问题 I need to deploy a WCF service with a database on client machines. I am confused about SQL Server Express. I need to verify all of the following. When attaching database files in the App_Data folder, do I still need to install SQL Server Express engine (Windows service) on client machines? There is a flavor called SQL Server Express LocalDb . That one does not need an engine (Windows service)? But I think it need a prerequisite installation of LocalDb. Localdb is introduced with SQL Server

SQL Server Express vs express localdb

不羁岁月 提交于 2019-11-27 02:39:35
问题 I am having quite a few problems understanding differences between regular SQL Server Express and express Localdb. Before you go ahead and tag a previous post about this question, I've went through question history quite a few times. The resources that I found somewhat helpful were: Is there a difference between SQL Server Express (2012) and LocalDB? and an official Microsoft page article about it. I believe I do understand that Express Localdb is an edition of SQL Server Express, that is