Factory pattern 工厂模式-自动接线问题
我正在使用subsonic2生成的类,并希望为测试添加一层抽象,我创建了一个基本接口,就这样Factory pattern 工厂模式-自动接线问题,factory-pattern,Factory Pattern,我正在使用subsonic2生成的类,并希望为测试添加一层抽象,我创建了一个基本接口,就这样 public interface IController<TCollection> where TCollection : class { TCollection FetchAll(); TCollection FetchByID(object id); TCollection FetchByQuery(Query query); bool Dele
public interface IController<TCollection>
where TCollection : class
{
TCollection FetchAll();
TCollection FetchByID(object id);
TCollection FetchByQuery(Query query);
bool Delete(object id);
//void Insert(TEntity entity);
//void Update(TEntity entity);
}
公共接口IController
where-TCollection:class
{
t收集FetchAll();
t收集FetchByID(对象id);
t收集FetchByQuery(查询查询);
bool Delete(对象id);
//无效插入(TEntity实体);
//无效更新(潜在实体);
}
这很好,我创建了一个“扩展”类文件夹,在其中删除了一个类并扩展了该类
public partial class AddressController : IController<AddressCollection> { }
公共部分类AddressController:IController{}
没问题,耶。然后我突然想到——有239个这样的类,我不打算手工制作它们,软件必须有一种方法来实现这一点,我很懒,所以我开始研究一种工厂模式,它将返回IController