1.IBLL
namespace IBll{ public interface IPersonBll { int Add(string name,string type); }}
2.BLL 继承IBLL 并且实现
namespace BLL{ public class PersonBll : IPersonBll { private static readonly PersonBll instance = new PersonBll(); private PersonBll() { } public static PersonBll GetInstance() { return instance; } public int Add(string name, string type) { return 1; } }}
3.Factory 创建需要用的接口
namespace Factory{ public class Facotry { private static readonly Facotry instance = new Facotry(); private Facotry() { } public static Facotry getInstance() { return instance; } public IPersonBll Create_IpersonBll() { return PersonBll.GetInstance(); } }}
4.调用
IBll.IPersonBll personBll = Factory.Facotry.getInstance().Create_IpersonBll();