Beispiel #1
0
        private void ConfigureServiceModel(DocumentContextBase documentContextBase)
        {
            Contract.Requires(documentContextBase != null);

            // If we already have the service model, no need to create the service model.
            if (this.GetServiceModel() != null)
            {
                return;
            }

            var serviceModelBuilder = new ServiceModelBuilder();

            documentContextBase.OnServiceModelCreating(serviceModelBuilder);

            var conventions  = this.GetConventions();
            var serviceModel = serviceModelBuilder.Create(conventions);

            if (serviceModel.ResourceTypes.Any() == false)
            {
                // Do not accept an empty service model, this will cause an InternalException
                // to be thrown when validating the final configuration of the document context.
                return;
            }

            this.SetServiceModel(serviceModel);
        }
        public static IServiceModel CreateServiceModel()
        {
            var serviceModelBuilder = new ServiceModelBuilder();

            serviceModelBuilder.Configurations.Add(new AuthorConfiguration());


            serviceModelBuilder.HomeResource <HomeDocument>();

            var conventions  = CreateConventions();
            var serviceModel = serviceModelBuilder.Create(conventions);

            return(serviceModel);
        }
        public static IServiceModel CreateServiceModel()
        {
            var serviceModelBuilder = new ServiceModelBuilder();

            serviceModelBuilder.Configurations.Add(new ApiEntryPointConfiguration());
            serviceModelBuilder.Configurations.Add(new ArticleConfiguration());
            serviceModelBuilder.Configurations.Add(new BlogConfiguration());
            serviceModelBuilder.Configurations.Add(new CommentConfiguration());
            serviceModelBuilder.Configurations.Add(new PersonConfiguration());

            serviceModelBuilder.HomeResource <ApiEntryPoint>();

            var conventions  = CreateConventions();
            var serviceModel = serviceModelBuilder.Create(conventions);

            return(serviceModel);
        }
Beispiel #4
0
        public static IServiceModel CreateServiceModel()
        {
            var serviceModelBuilder = new ServiceModelBuilder();

            serviceModelBuilder.Configurations.Add(new PatreonUserConfiguration());
            serviceModelBuilder.Configurations.Add(new PatreonPledgeConfiguration());
            serviceModelBuilder.Configurations.Add(new PatreonRewardConfiguration());
            serviceModelBuilder.Configurations.Add(new PatreonCampaignConfiguration());

            // Configure the ApiEntryPoint resource as the "home" document.
            serviceModelBuilder.HomeResource <PatreonUser>();

            var conventions  = CreateConventions();
            var serviceModel = serviceModelBuilder.Create(conventions);

            return(serviceModel);
        }
Beispiel #5
0
        public static IServiceModel CreateServiceModel()
        {
            var serviceModelBuilder = new ServiceModelBuilder();

            serviceModelBuilder.Configurations.Add(new HomeServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new CustomerServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new AlbumServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new ArtistServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new EmployeeServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new GenreServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new InvoiceServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new InvoiceItemServiceModelConfiguration());
            serviceModelBuilder.Configurations.Add(new MediaTypeModelConfiguration());
            serviceModelBuilder.Configurations.Add(new PlaylistModelConfiguration());
            serviceModelBuilder.Configurations.Add(new TrackModelConfiguration());
            serviceModelBuilder.HomeResource <Home>();

            var createConventions = CreateConventions();
            var serviceModel      = serviceModelBuilder.Create(createConventions);

            return(serviceModel);
        }