CHAPTER 1
When writing many applications, you will almost certainly need some kind of database. And when you use a database, you’re going to have to work with it. Whether you have database administrators (DBAs) or develop both the database and the application, a little database knowledge always comes in handy.
This book is for everyone who develops C# applications with a SQL Server database. In this book, we’re going to connect to a database using classic ADO.NET, and using the Entity Framework, we’re going to look at different methods to develop your database. We’ll see common pitfalls, why your database is running slow, how we can troubleshoot performance issues, and how we can test and deploy our SQL Server database. The first half of the book has a focus on C# and development. The second half of the book has a focus on troubleshooting using the SQL Server tools.
C# and SQL (the query language) knowledge is assumed.
In this book we’ll make use of Visual Studio 2015 Community Edition and SQL Server 2014 Express on a Windows machine (I’m using Windows 8.1 Pro and Windows 10). You will need a Microsoft account to download these files. When prompted for a specific SQL Server Express version, pick SQL Server Express with Tools (or SQL Server Express with Advanced Services, if you want to play around with Reporting Services and Full Text Search, which aren’t a part of this book).
The provided links take you to the product website and will probably let you download the newest version of the respective tool. You may download the newest version at your own risk (the examples in this book probably still apply), or you may search for the version I have used throughout this book. Most of the examples also apply to older versions of the tools, so if you already have something installed, just continue and see if it works.
Installation is pretty straightforward. When installing Visual Studio, make sure you select the SQL Server Data Tools check box, and when installing SQL Server, make sure you select Management Tools - Complete. When prompted for an instance name in the SQL Server installer, pick any name you like, or choose Default instance (my instance is called SQLEXPRESS). Other than that, you can leave on all the defaults, accept the license terms, and just click Next, Next, Next.