由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - 同事的这个generic工厂interface让我蛋疼
相关主题
新手请教:如何理解generic interface can be an retrun type从国内连接 mitbbs
c# 内存管理的一个小问题template?
Can a struct be derived? in C#, in C++Tried Visual Studio 2005 Beta
Question about Explicit interface members in c#C# question
payan, talk a little bit about rainbowHTTP GET over SSL in C#
review a c# book today and find i am obosoleteIE developer toolbar
Generics你们最不喜欢.net的什么?
hexadecimal value 0x00, is an invalid chDemos from MIX08
相关话题的讨论汇总
话题: interface
进入DotNet版参与讨论
1 (共1页)
k**n
发帖数: 3989
1
同事给的代码是这样的
代码:
internal interface IWidgetModelFactory TFactoryResponse, TFactoryDtoRequest, in TFactoryDtoResponse>
{
TFactoryDtoRequest _request { get; set; }
List GetModelData(TFactoryRequest request);
List CreateModel(TFactoryDtoResponse response);
}
GetModelDate 里将TFactoryRequest map为 服务层proxy里的TFactoryDtoRequest, 发
送到服务层并得到TFactoryDtoResponse实例,然后call CreateModel(dto)得到
TFactoryResponse 并返回。
我觉得这个factory interface不好用,要四个type太多了,分成两个interface,每个
interface只需要两个generic type就比较容易使用,也更灵活。
我是把对应service层的dtoRequest/dtoResponse放到另一个Factory或helper里就行了
。。。
不知各高手有什么想法?
t********n
发帖数: 728
2
从本质上说你的和他的没啥区别, 他的就是一锅煮, 你的是煮饭加炒菜。个人不推荐
这种看起来很炫的编程方式,因为几乎没法maintain, 除非是写framework啥的。
n*w
发帖数: 3393
3
I think you are right. lsp
1 (共1页)
进入DotNet版参与讨论
相关主题
Demos from MIX08payan, talk a little bit about rainbow
[讨论]Does asp.net start from the wrong foot?review a c# book today and find i am obosolete
不看不知道,GAC里的东西太多了 Generics
C# is light-years ahead of Java now (转载)hexadecimal value 0x00, is an invalid ch
新手请教:如何理解generic interface can be an retrun type从国内连接 mitbbs
c# 内存管理的一个小问题template?
Can a struct be derived? in C#, in C++Tried Visual Studio 2005 Beta
Question about Explicit interface members in c#C# question
相关话题的讨论汇总
话题: interface