public void SetConfiguration(IBookablePairIdTemplate template, SingleIdTemplate <SellerIdComponents> sellerTemplate)
        {
            if (template as BookablePairIdTemplate <TComponents> == null)
            {
                throw new NotSupportedException($"{template.GetType().ToString()} does not match {typeof(BookablePairIdTemplate<TComponents>).ToString()}. All types of IBookableIdComponents (T) used for BookablePairIdTemplate<T> assigned to feeds via settings.IdConfiguration must match those used for RPDEFeedGenerator<T> in settings.OpenDataFeeds.");
            }

            base.SetConfiguration((BookablePairIdTemplate <TComponents>)template, sellerTemplate);
        }
예제 #2
0
        public void SetConfiguration(OpportunityTypeConfiguration opportunityTypeConfiguration, Uri jsonLdIdBaseUrl, int rpdePageSize, IBookablePairIdTemplate bookablePairIdTemplate, SingleIdTemplate <SellerIdComponents> sellerTemplate, Uri openDataFeedBaseUrl)
        {
            if (!(bookablePairIdTemplate is BookablePairIdTemplate <TComponents>))
            {
                throw new InternalOpenBookingException(new InternalLibraryConfigurationError(), $"{bookablePairIdTemplate.GetType()} does not match {typeof(BookablePairIdTemplate<TComponents>)}. All types of IBookableIdComponents (T) used for BookablePairIdTemplate<T> assigned to feeds via settings.IdConfiguration must match those used for RPDEFeedGenerator<T> in settings.OpenDataFeeds.");
            }

            if (opportunityTypeConfiguration.SameAs.AbsolutePath.Trim('/') != typeof(TClass).Name)
            {
                throw new InternalOpenBookingException(new InternalLibraryConfigurationError(), $"'{GetType()}' does not have this expected OpenActive model type as generic parameter: '{opportunityTypeConfiguration.SameAs.AbsolutePath.Trim('/')}'");
            }

            base.SetConfiguration((BookablePairIdTemplate <TComponents>)bookablePairIdTemplate, sellerTemplate);

            RpdePageSize = rpdePageSize;

            // Allow these to be overridden by implementations if customisation is required
            FeedUrl  = FeedUrl ?? new Uri(openDataFeedBaseUrl + opportunityTypeConfiguration.DefaultFeedPath);
            FeedPath = FeedPath ?? opportunityTypeConfiguration.DefaultFeedPath;
        }