Skip to content

Instantly share code, notes, and snippets.

@jchannon
Created March 22, 2012 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchannon/2159559 to your computer and use it in GitHub Desktop.
Save jchannon/2159559 to your computer and use it in GitHub Desktop.
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