Skip to content

Instantly share code, notes, and snippets.

@johnnonolan
Created March 12, 2012 14:27
Show Gist options
  • Save johnnonolan/2022280 to your computer and use it in GitHub Desktop.
Save johnnonolan/2022280 to your computer and use it in GitHub Desktop.
hi
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