-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Daily check-in, implementing dependency injection for data connection…
…. Work in progress
- Loading branch information
Showing
30 changed files
with
574 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Configuration; | ||
using PiLot.Data.Nav; | ||
|
||
namespace PiLot.API.Helpers | ||
{ | ||
|
||
/// <summary> | ||
/// This helps using either a files based or db based data connection. | ||
/// If a connectionString is defined, the db connectors will be used, | ||
/// otherwise the files based connectors will be used. It's called | ||
/// dependency injection, I quess. | ||
/// </summary> | ||
public class DataConnectionHelper { | ||
|
||
public static IPoiDataConnector PoiDataConnector { | ||
get { | ||
IPoiDataConnector result = null; | ||
String connectionString = ConfigurationManager.AppSettings["connectionString"]; | ||
if (!String.IsNullOrEmpty(connectionString)) { | ||
result = new Data.Postgres.Nav.PoiDataConnector(connectionString); | ||
} else { | ||
result = new Data.Files.PoiDataConnector(); | ||
} | ||
return result; | ||
} | ||
} | ||
|
||
/*public static ITrackDataConnector TrackDataConnector { | ||
get { | ||
ITrackDataConnector result = null; | ||
String connectionString = ConfigurationManager.AppSettings["connectionString"]; | ||
if (!String.IsNullOrEmpty(connectionString)) { | ||
result = new Data.Postgres.Nav.TrackDataConnector(connectionString); | ||
} else { | ||
result = new Data.Files.TrackDataConnector(); | ||
} | ||
return result; | ||
} | ||
}*/ | ||
} | ||
} |
Oops, something went wrong.