Skip to content

Commit 5f07633

Browse files
committed
Use Windows Auth to connect to the database
Fixes #111
1 parent e4766d7 commit 5f07633

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

Diff for: Docs/GettingStarted.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# Database Setup
22
1. Install SQL Server
33
- You will need to install [SQL Server](http://downloadsqlserverexpress.com). The best option - but the biggest download file - is the `SQL Server Express with Advanced Services` option. This will give you what is needed in order to run the server and a full suite of managment tools.
4-
2. Run the [scripts located here](https://github.com/M-Zuber/MyHome/tree/Testing/MyHome.Persistence/Scripts)
5-
- This will create the tables and an user to connect with SQL Server not using Windows authentication
6-
3. Verify that SQL Server has mixed/SQL authentication enabled, otherwise the program will not be able to connect
4+
2. We are using EF Code first. There is no second step.
75

86
##Trouble Shooting
97
If the program still doesn't work, try the following:

Diff for: MyHome.Persistence/AccountingDataContext.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ namespace MyHome.Persistence
66
{
77
public class AccountingDataContext : DbContext
88
{
9-
public const string ConnectionString = @"Server=.;Database=MyHome;User Id=home_user;Password=homeuser;";
10-
11-
public AccountingDataContext() : base(ConnectionString)
9+
public AccountingDataContext() : base("name=Database")
1210
{
1311
}
1412

Diff for: MyHome.Persistence/app.config

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
1515
</providers>
1616
</entityFramework>
17+
<connectionStrings>
18+
<add name="Database" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=MyHome;Integrated Security=true" />
19+
</connectionStrings>
1720
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup></configuration>

Diff for: MyHome.UI/app.config

+3
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
1818
</providers>
1919
</entityFramework>
20+
<connectionStrings>
21+
<add name="Database" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=MyHome;Integrated Security=true" />
22+
</connectionStrings>
2023
</configuration>

0 commit comments

Comments
 (0)