Skip to content

Commit

Permalink
Use Windows Auth to connect to the database
Browse files Browse the repository at this point in the history
Fixes #111
  • Loading branch information
M-Zuber committed Dec 30, 2015
1 parent e4766d7 commit 5f07633
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Docs/GettingStarted.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Database Setup
1. Install SQL Server
- 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.
2. Run the [scripts located here](https://github.com/M-Zuber/MyHome/tree/Testing/MyHome.Persistence/Scripts)
- This will create the tables and an user to connect with SQL Server not using Windows authentication
3. Verify that SQL Server has mixed/SQL authentication enabled, otherwise the program will not be able to connect
2. We are using EF Code first. There is no second step.

##Trouble Shooting
If the program still doesn't work, try the following:
Expand Down
4 changes: 1 addition & 3 deletions MyHome.Persistence/AccountingDataContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ namespace MyHome.Persistence
{
public class AccountingDataContext : DbContext
{
public const string ConnectionString = @"Server=.;Database=MyHome;User Id=home_user;Password=homeuser;";

public AccountingDataContext() : base(ConnectionString)
public AccountingDataContext() : base("name=Database")
{
}

Expand Down
3 changes: 3 additions & 0 deletions MyHome.Persistence/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="Database" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=MyHome;Integrated Security=true" />
</connectionStrings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup></configuration>
3 changes: 3 additions & 0 deletions MyHome.UI/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<connectionStrings>
<add name="Database" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=MyHome;Integrated Security=true" />
</connectionStrings>
</configuration>

0 comments on commit 5f07633

Please sign in to comment.