Beispiel #1
0
        // PRIVATE METHODS //////////////////////////////////////////////////
        #region Factory Methods
        private static IDocumentContextOptions CreateDocumentContextOptions(IServiceModel apiServiceModel,
                                                                            IHypermediaAssemblerRegistry apiHypermediaAssemblerRegistry,
                                                                            IOptions <ApiHypermediaOptions> apiHypermediaOptionsAccessor)
        {
            Contract.Requires(apiServiceModel != null);
            Contract.Requires(apiHypermediaOptionsAccessor != null);

            var options        = new DocumentContextOptions <DocumentContext>();
            var optionsBuilder = new DocumentContextOptionsBuilder(options);

            optionsBuilder.UseServiceModel(apiServiceModel);
            if (apiHypermediaAssemblerRegistry != null)
            {
                optionsBuilder.UseHypermediaAssemblerRegistry(apiHypermediaAssemblerRegistry);
            }

            var apiHypermediaOptions = apiHypermediaOptionsAccessor.Value;

            var scheme = apiHypermediaOptions.Scheme;
            var host   = apiHypermediaOptions.Host;
            var port   = apiHypermediaOptions.Port;
            var urlBuilderConfiguration = new UrlBuilderConfiguration(scheme, host, port);

            optionsBuilder.UseUrlBuilderConfiguration(urlBuilderConfiguration);

            return(options);
        }
Beispiel #2
0
        // PRIVATE METHODS //////////////////////////////////////////////////
        #region Initialization Methods
        private void ConfigureOptions(DocumentContextBase documentContextBase)
        {
            Contract.Requires(documentContextBase != null);

            var options        = this.Options;
            var optionsBuilder = new DocumentContextOptionsBuilder(options);

            documentContextBase.OnConfiguring(optionsBuilder);
        }