public static IRestBuilder AddXml(this IRestBuilder builder)
        {
            // Services
            builder.ServiceCollection.AddTransient <IXmlSerializer, XmlSerializer>();

            // Formatters
            builder.AddOutputFormatter(new XmlOutputFormatter());

            return(builder);
        }
        public static IRestBuilder AddJson(this IRestBuilder builder, JsonSerializerSettings jsonSerializerSettings = null)
        {
            // Services
            builder.ServiceCollection.AddTransient <IJsonSerializer, JsonSerializer>();
            builder.ServiceCollection.AddSingleton(jsonSerializerSettings ?? DefaultJsonSerializerSettings);

            // Formatters
            builder.AddOutputFormatter(new JsonOutputFormatter());

            return(builder);
        }
Beispiel #3
0
        public static IRestBuilder AddHypermedia(this IRestBuilder builder)
        {
            // Services
            builder.ServiceCollection.AddSingleton <IApiHelper, ApiHelper>();
            builder.ServiceCollection.AddTransient <IHypermediaSerializer, HypermediaSerializer>();
            builder.ServiceCollection.AddTransient <IHypermediaActionFormService, HypermediaActionsFormService>();
            builder.ServiceCollection.AddTransient <IHypermediaActionsService, HypermediaActionsService>();
            builder.ServiceCollection.AddTransient <IHypermediaClassService, HypermediaClassService>();
            builder.ServiceCollection.AddSingleton <IHypermediaFieldService, HypermediaFieldService>();
            builder.ServiceCollection.AddTransient <IHypermediaLinksService, HypermediaLinksService>();
            builder.ServiceCollection.AddTransient <IHypermediaPropertiesService, HypermediaPropertiesService>();
            builder.ServiceCollection.AddTransient <IHypermediaSubEntitiesService, HypermediaSubEntitiesService>();
            builder.ServiceCollection.AddTransient <IHypermediaTitleGenerator, HypermediaTitleService>();

            // Formatters
            builder.AddOutputFormatter(new HypermediaOutputFormatter());

            return(builder);
        }