Business Objects Collection 中具有 lambda 标准的通用方法
我的应用程序中的每个业务对象都有抽象类 (BO) 还有父(通用)集合来存储所有 BO(名为 BOC - 业务对象集合)
我想要存档的是在 BOC 内创建的通用方法,类似于:
public T GetBusinessObject (lambda_criteria)
所以我可以调用类似于以下的方法:
Employee emp = BOC.GetBusinessObject( Employee.ID=123 )
并且方法应返回满足指定 lambda 标准的 BO
有如何存档的提示吗?
I have abstract class for each Business Object in my app (BO)
Also have parent (generic) collection to store all BOs (named BOC - Business Object Collection)
What I would like to archive is created universal method iniside BOC similar to:
public T GetBusinessObject (lambda_criteria)
So I could call this method similar to:
Employee emp = BOC.GetBusinessObject( Employee.ID=123 )
And method shall return BO meet to specified lambda criteria
Any tips how to archive that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设您的 BOC 在内部继承或使用通用列表,这并不太难:
Assuming that your BOC inherits from or uses a generic list internally it's not too hard:
类似的东西
,然后
可能会被称为类似的东西?
Something like
and then called like
perhaps?
如果这是一个通用集合,那么调用者应该已经(通过 LINQ)能够使用:
那可以吗?
If this is a generic collection, then the caller should already (via LINQ) be able to use:
that do?