I make a separate readonly list of readonly digest objects (or structs) that are lightweight and cannot be manipulated. The collection can be customized for whatever needs you might have as normal. Retrieval of a full object can be used by passing a "digest" object to a type conversion, or factory or constructor - whatever techniques you are using.
Note that this is an optimization which only happens when a collection of full-blown objects is simply getting too slow. It can easily be created at that point. Generally such classes are not created until necessary.
发布评论
评论(2)
我创建了一个单独的只读摘要对象(或结构)的只读列表,这些对象是轻量级且无法操作的。 该系列可以根据您通常的任何需求进行定制。 可以通过将“摘要”对象传递给类型转换、工厂或构造函数来检索完整对象 - 无论您使用什么技术。
请注意,这是一种优化,仅当成熟对象的集合变得太慢时才会发生。 此时可以轻松创建它。 通常,只有必要时才创建此类。
I make a separate readonly list of readonly digest objects (or structs) that are lightweight and cannot be manipulated. The collection can be customized for whatever needs you might have as normal. Retrieval of a full object can be used by passing a "digest" object to a type conversion, or factory or constructor - whatever techniques you are using.
Note that this is an optimization which only happens when a collection of full-blown objects is simply getting too slow. It can easily be created at that point. Generally such classes are not created until necessary.
有很多框架可以执行您所讨论的这种 o/r 映射。
您需要付出更多的开销来换取易用性和强大的配置。
请参阅 Hibernate 或 NHibernate(如果您使用的是 .net)。
There are a lot of frameworks out there that do this sort of o/r mapping you're talking about.
You're trading a little more overhead for ease of use and robust configuration.
See Hibernate or NHibernate if you're using .net.