Database Reference
In-Depth Information
The MVC-EF example
Many C# developers create programs using MVC-EF as defined in Microsoft architecture
best practices. We will look at the example enclosed in this topic called
MVC-SQL
with an
MVCApp
project. This project will read the selected queues from the browser and display
what they contain. We will read the available queues in the browser without the need to go
through SQL Management Studio.
MVCApp
is the main program that runs
MVC-EF
in SQL Server to view the tables created
in the
PubSub-SQL
solution. However, the PubSub-SQL solution needs to be run first.
These examples were run in VS 2012 in Windows Server 2012, with MSMQ, DTC, NSer-
viceBus references, and SQL Server 2012 Express LocalDB installed.
In order to get access to these tables in the
nservicebus
database, we need to create ob-
jects that map to the tables. In order to do that, we add the ADO.NET Entity Data Model,
which will create the mapping to the tables.
A database context will have to be added that will put a connection string in the
app.config
file or the
web.config
file for MVC. In this case, the connection string
will be
nservicebusrnentities
.