Created
March 22, 2012 16:48
-
-
Save jchannon/2159559 to your computer and use it in GitHub Desktop.
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
public class MainEntryPointClass : BaseClass | |
{ | |
private ILogic Logic; | |
public MainEntryPointClass(ILogic Logic) | |
{ | |
this.Logic = Logic; | |
} | |
public MainEntryPointClass () : this(new Logic()) | |
{ | |
} | |
public SetupProperties() | |
{ | |
this.ConfigProperties.Add(typeof(string), "DirectoryPath", "C:\\"); | |
} | |
public Run() | |
{ | |
//Set some properties on Logic by reading this.ConfigProperties. This is the first time ConfigProperties can be read. | |
Logic.ITimer = new Timer(); | |
Logic.IFileLogger = new FileLogger(this.ConfigProperties.Find("DirectoryPath").Value()); | |
Logic.RandomProperty = this.ConfigProperties.Find(..).Value(); | |
} | |
} | |
public class Logic : ILogic | |
{ | |
public ITimer Timer{get;set;} | |
public ILogger Logger{get;set;} | |
public class Logic() | |
{ | |
} | |
public SomeMethod() | |
{ | |
this.Logger.Write("Data"); /******* How does DirectoryPath get assigned? *******/ | |
} | |
} | |
public interface IFileLogger | |
{ | |
void WriteData(string Data); | |
} | |
public class FileLogger : IFileLogger | |
{ | |
public FileLogger(string Directory) | |
{ | |
this.DirectoryPath = Directory; | |
} | |
public void WriteData(string Data) | |
{ | |
} | |
public string DirectoryPath { get; private set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment