Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Database Server Installation and Configuration6:16 with James Churchill
In order to use Entity Framework in your local development environment, you need to have a database server. Let's confirm if you have SQL Server LocalDB installed and configured correctly, and if not, how to install and configure it.
[MUSIC] 0:00 Even though Entity Framework supports variety of databases, the vast majority of 0:05 the time you'll be targeting Microsoft's own SQL Server database. 0:09 SQL Server is a robust enterprise-grade database server that can be 0:14 installed on your own local machines or ran in the cloud on virtual machines. 0:18 SQL Server is even available as a service 0:23 on Microsoft's Azure cloud computing platform. 0:26 When developing applications with EF, we can target a developer-centric 0:30 version of SQL Server, appropriately named LocalDB. 0:34 LocalDB is easier to install and configure than the full SQL Server product. 0:38 Developing database-backed applications is so commonplace that when you install 0:44 Visual Studio Community, LocalDB will be installed by default. 0:49 So if you have Visual Studio Community installed, 0:53 you should have LocalDB installed. 0:57 But development environments and 0:59 their configuration can sometimes vary in unexpected ways. 1:01 In this video, we'll verify that LocalDB is installed and 1:06 configured to work correctly with EF. 1:10 Let's start with checking if LocalDB is installed. 1:13 Open a command prompt window and run the command sqllocaldb. 1:17 If LocalDB is installed, 1:24 you'll see information about the SQL Server Express LocalDB command line tool, 1:26 including the version number and a list of the operations that you can perform. 1:31 This tells us that this environment has LocalDB installed. 1:36 LocalDB has a notion of named instances. 1:43 We'll see an example of how they're used in the next video. 1:46 To see a list of the instances that are available, 1:50 we can add the info operation just after the sqllocaldb command. 1:53 sqllocaldb, space, info. 1:57 This environment has two LocalDB instances, 2:02 MSSQLLocalDB and ProjectsV13. 2:07 MSSQLLocalDB is the default instance name used by SQL Server 2014 and 2:10 2016, versions 12 and 13 respectively. 2:16 SQL Server 2012 or version 11 used a default instance named V11.0. 2:20 EF will look for and connect to a LocalDB instance named MSSQLLocalDB. 2:27 So this environment is properly configured to support EF development. 2:34 The project's V13 instance is created specifically for 2:39 SQL Server data tools, and shouldn't be used for application development. 2:43 SQL Server Data Tools or 2:48 SSDT is a set of database development tools for Visual Studio. 2:50 SSDT is beyond the scope of this course. 2:55 See the teacher's notes for more information. 2:58 Let's switch to an installation of Windows 10 that doesn't have Visual Studio or 3:02 LocalDB installed. 3:06 I'll open a Command Prompt window and run the sqllocaldb command. 3:09 And we get an error message, sqllocaldb is not recognized 3:16 as an internal or external command, operable program or batch file. 3:21 This error message is a likely indication that LocalDB isn't installed. 3:26 If we open the Windows 10 App & features window, we can 3:31 scroll through the list of installed apps and see that LocalDB isn't in the list. 3:34 To install LocalDB, we need to first download the SQL Server Express installer. 3:41 Open a browser and search for SQL Server Express download. 3:47 Here's the link to download the installer. 3:55 Select your preferred language and click Download. 4:02 Click Yes to allow this app to make changes to your device. 4:13 When prompted to select an installation type, click on the Download Media option. 4:19 Then we can select to download the LocalDB installer. 4:25 When the download has completed, click Open folder to browse through the folder 4:37 that the installer was downloaded to. 4:41 Double-click the SqlLocalDB file to start the installation wizard and 4:43 follow the prompts. 4:48 Once the installation process is completed, close all of the open windows. 5:06 Open a Command Prompt window and run the sqllocaldb command. 5:11 Looks good so far. 5:22 Now run the sqllocaldb info command. 5:24 We have a single instance named MSSQLLocalDB. 5:31 So now we're all set to use EF. 5:36 If you need to create an instance, you can run the sqllocaldb 5:38 command along with the create operation and the name of the instance. 5:42 Running the sqllocaldb info command again shows that we now have two instances. 5:52 We can delete the test instance using the delete operation 6:00 followed by the name of the instance to delete. 6:05 Running the sqllocaldb info command again shows that the test instance is now gone. 6:09
You need to sign up for Treehouse in order to download course files.Sign up