Created
August 13, 2012 01:06
-
-
Save shanefulmer/3336101 to your computer and use it in GitHub Desktop.
Handler 4
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 interface ISomeTextService { string DoSomething(); } | |
public class SomeTextService : ISomeTextService { public string DoSomething() { return string.Empty; } } | |
public interface ISomeHtmlService { string DoSomethingElse(); } | |
public class SomeHtmlService : ISomeHtmlService { public string DoSomethingElse() { return string.Empty; } } | |
public enum RenderType {Text, Html} | |
public interface IRenderer<T> { string Render(T obj); } | |
public class FooTextRenderer : IRenderer<Foo> | |
{ | |
private readonly ISomeTextService _someTextService; | |
public FooTextRenderer(ISomeTextService someTextService) { _someTextService = someTextService; } | |
public string Render(Foo foo) | |
{ | |
return "this is a foo" + _someTextService.DoSomething(); | |
} | |
} | |
public class FooHtmlRenderer : IRenderer<Foo> | |
{ | |
private readonly ISomeHtmlService _someHtmlService; | |
public FooHtmlRenderer(ISomeHtmlService someHtmlService) { _someHtmlService = someHtmlService; } | |
public string Render(Foo foo) | |
{ | |
return "this is a foo" + _someHtmlService.DoSomethingElse(); | |
} | |
} | |
public class Foo | |
{ | |
// foo domain logic | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment