Currently, the Topic entity has a lot of extraneous plumbing and complexity that's needed exclusively for the potential that topics are going to be created, modified, or deleted. But that's only true on e.g., the OnTopic Editor, and any Topic-targeting forms that implementors establish. In the vast majority of cases, topics will be read-only. Given this, we could dramatically simplify Topic to just be read-only, then move all of that extra plumbing to a new WritableTopic.
Considerations
This option needs to be fleshed out, but some initial notes:
- This may not make sense as a derived type of
Topic; it may make more sense as a wrapper
- In addition to obvious members like
IsDirty() and MarkClean(), this could simplify other related members:
- We could remove
DerivedType, and bake in the inheritance when the topic hierarchy is being established
VersionHistory could not only be removed, but could also be skipped as part of the LoadTopics stored procedure for read-only versions
- This could use a simplified
ReadOnlyCollection derivative for Attributes
- The
AttributesCollection and underlying TrackedRecordCollection<> include a lot of write plumbing!
- E.g.,
_topicPropertyDispatcher, DeletedItems, IsDirty(), AllowClean(), MarkClean(), ClearItems(), and SetValue()
- E.g., all of the overrides like
InsertItem(), SetItem(), and RemoveItem()
- The
AttributesCollection would likely still need to be supported on the WritableTopic, potentially inheriting from the new read-only collection
- We should determine how much practical overhead the writable plumbing actually introduces in a day-to-day capacity
- This may be pretty trivial, outside of cluttering and complicating the public interface
Currently, the
Topicentity has a lot of extraneous plumbing and complexity that's needed exclusively for the potential that topics are going to be created, modified, or deleted. But that's only true on e.g., the OnTopic Editor, and any Topic-targeting forms that implementors establish. In the vast majority of cases, topics will be read-only. Given this, we could dramatically simplifyTopicto just be read-only, then move all of that extra plumbing to a newWritableTopic.Considerations
This option needs to be fleshed out, but some initial notes:
Topic; it may make more sense as a wrapperIsDirty()andMarkClean(), this could simplify other related members:DerivedType, and bake in the inheritance when the topic hierarchy is being establishedVersionHistorycould not only be removed, but could also be skipped as part of theLoadTopicsstored procedure for read-only versionsReadOnlyCollectionderivative forAttributesAttributesCollectionand underlyingTrackedRecordCollection<>include a lot of write plumbing!_topicPropertyDispatcher,DeletedItems,IsDirty(),AllowClean(),MarkClean(),ClearItems(), andSetValue()InsertItem(),SetItem(), andRemoveItem()AttributesCollectionwould likely still need to be supported on theWritableTopic, potentially inheriting from the new read-only collection