Created
March 12, 2012 14:27
-
-
Save johnnonolan/2022280 to your computer and use it in GitHub Desktop.
hi
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text; | |
namespace TestUoWPoC | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var service = new myService(new MyRepo(), new MyOtherRepo()); | |
service.Go(); | |
} | |
} | |
public class myService | |
{ | |
IRepo _myRepo; | |
IRepo _myOtherRepo; | |
public myService(IRepo myRepo, IRepo myOtherRepo) | |
{ | |
_myOtherRepo = myOtherRepo; | |
_myRepo = myRepo; | |
} | |
public void Go() | |
{ | |
using ( var uow = new UoW(this)) | |
{ | |
Console.WriteLine("Going"); | |
} | |
} | |
} | |
public class UoW : IDisposable | |
{ | |
public UoW(myService myService) | |
{ | |
} | |
public void Dispose() | |
{ | |
} | |
} | |
public interface IRepo | |
{ | |
string SayHi(); | |
} | |
public class MyRepo : IRepo | |
{ | |
public string SayHi() | |
{ | |
return "Hi my repo"; | |
} | |
} | |
public class MyOtherRepo : IRepo | |
{ | |
public string SayHi() | |
{ | |
return "Hi my other repo"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment