@@ -34,7 +34,6 @@ public class SqlTopicRepository : TopicRepositoryBase, ITopicRepository {
3434 /*==========================================================================================================================
3535 | PRIVATE VARIABLES
3636 \-------------------------------------------------------------------------------------------------------------------------*/
37- private ContentTypeDescriptorCollection _contentTypeDescriptors = null ;
3837 private readonly string _connectionString = null ;
3938
4039 /*==========================================================================================================================
@@ -264,56 +263,6 @@ private static void SetDerivedTopics(Dictionary<int, Topic> topics) {
264263
265264 }
266265
267- /*==========================================================================================================================
268- | GET CONTENT TYPE DESCRIPTORS
269- \-------------------------------------------------------------------------------------------------------------------------*/
270- /// <summary>
271- /// Retrieves a collection of Content Type Descriptor objects from the configuration section of the data provider.
272- /// </summary>
273- public override ContentTypeDescriptorCollection GetContentTypeDescriptors ( ) {
274-
275- /*------------------------------------------------------------------------------------------------------------------------
276- | Initialize content types
277- \-----------------------------------------------------------------------------------------------------------------------*/
278- if ( _contentTypeDescriptors == null ) {
279-
280- /*----------------------------------------------------------------------------------------------------------------------
281- | Load configuration data
282- \---------------------------------------------------------------------------------------------------------------------*/
283- var configuration = Load ( "Configuration" ) ;
284-
285- /*----------------------------------------------------------------------------------------------------------------------
286- | Add available Content Types to the collection
287- \---------------------------------------------------------------------------------------------------------------------*/
288- _contentTypeDescriptors = new ContentTypeDescriptorCollection ( ) ;
289-
290- /*----------------------------------------------------------------------------------------------------------------------
291- | Ensure the parent ContentTypes topic is available to iterate over
292- \---------------------------------------------------------------------------------------------------------------------*/
293- if ( configuration . Children . GetTopic ( "ContentTypes" ) == null ) {
294- throw new Exception ( "Unable to load section Configuration:ContentTypes." ) ;
295- }
296-
297- /*----------------------------------------------------------------------------------------------------------------------
298- | Add available Content Types to the collection
299- \---------------------------------------------------------------------------------------------------------------------*/
300- foreach ( var topic in configuration . Children . GetTopic ( "ContentTypes" ) . FindAllByAttribute ( "ContentType" , "ContentType" ) ) {
301- // Ensure the Topic is used as the strongly-typed ContentType
302- // Add ContentType Topic to collection if not already added
303- if (
304- topic is ContentTypeDescriptor contentTypeDescriptor &&
305- ! _contentTypeDescriptors . Contains ( contentTypeDescriptor . Key )
306- ) {
307- _contentTypeDescriptors . Add ( contentTypeDescriptor ) ;
308- }
309- }
310-
311- }
312-
313- return _contentTypeDescriptors ;
314-
315- }
316-
317266 /*==========================================================================================================================
318267 | METHOD: SET VERSION HISTORY
319268 \-------------------------------------------------------------------------------------------------------------------------*/
@@ -752,22 +701,7 @@ public override int Save(Topic topic, bool isRecursive = false, bool isDraft = f
752701 /*------------------------------------------------------------------------------------------------------------------------
753702 | Validate content type
754703 \-----------------------------------------------------------------------------------------------------------------------*/
755- var contentTypes = GetContentTypeDescriptors ( ) ;
756- if ( ! contentTypes . Contains ( topic . Attributes . GetValue ( "ContentType" ) ) ) {
757- throw new Exception (
758- "The Content Type \" " + topic . Attributes . GetValue ( "ContentType" , "Page" ) + "\" referenced by \" " + topic . Key +
759- "\" could not be found. under \" Configuration:ContentTypes\" . There are " + contentTypes . Count +
760- " ContentTypes in the Repository."
761- ) ;
762- }
763- var contentType = contentTypes [ topic . Attributes . GetValue ( "ContentType" , "Page" ) ] ;
764-
765- /*------------------------------------------------------------------------------------------------------------------------
766- | Update content types collection, if appropriate
767- \-----------------------------------------------------------------------------------------------------------------------*/
768- if ( topic is ContentTypeDescriptor && ! contentTypes . Contains ( topic . Key ) ) {
769- _contentTypeDescriptors . Add ( topic as ContentTypeDescriptor ) ;
770- }
704+ var contentType = GetContentTypeDescriptors ( ) [ topic . Attributes . GetValue ( "ContentType" , "Page" ) ] ;
771705
772706 /*------------------------------------------------------------------------------------------------------------------------
773707 | Establish attribute strings
0 commit comments