using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using Microsoft.Practices.Unity;
namespace Example.LearnConsole {
class Program {
/// <summary>
/// 这是一个最基本的结构
/// </summary>
/// <param name="args"></param>
static void Main(string[] args) {
IUnityContainer uc = new UnityContainer();
uc.RegisterType<IService, CustomerService>();
IService service = uc.Resolve<IService>();
service.Show();
Console.Read();
}
}
public interface IService {
void Show();
}
public class CustomerService : IService {
public void Show() {
Console.WriteLine("Welcome");
}
}
public class Proxy {
IService service;
public Proxy(IService service) {
this.service = service;
}
}
}