public void SetDefaultODataPrefixWritingFalse(ODataVersion?version) { var options = new ODataSimplifiedOptions(version); options.SetOmitODataPrefix(false); options.GetOmitODataPrefix().Should().BeFalse(); options.GetOmitODataPrefix(ODataVersion.V4).Should().BeFalse(); options.GetOmitODataPrefix(ODataVersion.V401).Should().BeFalse(); options.EnableWritingODataAnnotationWithoutPrefix.Should().BeFalse(); }
public void SetV4ODataPrefixWritingTrue(ODataVersion?version) { var options = new ODataSimplifiedOptions(version); options.SetOmitODataPrefix(true, ODataVersion.V4); options.GetOmitODataPrefix().Should().Be(version != null && version != ODataVersion.V4); options.GetOmitODataPrefix(ODataVersion.V4).Should().BeTrue(); options.GetOmitODataPrefix(ODataVersion.V401).Should().BeTrue(); options.EnableWritingODataAnnotationWithoutPrefix.Should().Be(version != null && version != ODataVersion.V4); }
public void SetDefaultEnableWritingODataAnnotationWithoutPrefixTrue() { var options = new ODataSimplifiedOptions(); options.EnableWritingODataAnnotationWithoutPrefix = true; options.GetOmitODataPrefix().Should().BeTrue(); options.GetOmitODataPrefix(ODataVersion.V4).Should().BeTrue(); options.GetOmitODataPrefix(ODataVersion.V401).Should().BeTrue(); options.EnableWritingODataAnnotationWithoutPrefix.Should().BeTrue(); }
public void SetDefaultODataPrefixWritingFalse(ODataVersion?version) { var options = new ODataSimplifiedOptions(version); options.SetOmitODataPrefix(false); Assert.False(options.GetOmitODataPrefix()); Assert.False(options.GetOmitODataPrefix(ODataVersion.V4)); Assert.False(options.GetOmitODataPrefix(ODataVersion.V401)); Assert.False(options.GetOmitODataPrefix()); }
public void SetV4ODataPrefixWritingTrue(ODataVersion?version) { var options = new ODataSimplifiedOptions(version); options.SetOmitODataPrefix(true, ODataVersion.V4); Assert.Equal(version != null && version != ODataVersion.V4, options.GetOmitODataPrefix()); Assert.True(options.GetOmitODataPrefix(ODataVersion.V4)); Assert.True(options.GetOmitODataPrefix(ODataVersion.V401)); Assert.Equal(version != null && version != ODataVersion.V4, options.GetOmitODataPrefix()); }
public void SetDefaultEnableWritingODataAnnotationWithoutPrefixTrue() { var options = new ODataSimplifiedOptions(); options.SetOmitODataPrefix(true); Assert.True(options.GetOmitODataPrefix()); Assert.True(options.GetOmitODataPrefix(ODataVersion.V4)); Assert.True(options.GetOmitODataPrefix(ODataVersion.V401)); Assert.True(options.GetOmitODataPrefix()); }
public void SetEnableWritingODataAnnotationWithoutPrefixFalse(ODataVersion?version) { var options = new ODataSimplifiedOptions(version); options.SetOmitODataPrefix(false); Assert.False(options.GetOmitODataPrefix()); Assert.False(options.GetOmitODataPrefix(ODataVersion.V4)); Assert.False(options.GetOmitODataPrefix(ODataVersion.V401)); Assert.False(options.GetOmitODataPrefix()); }
public void SetV401ODataPrefixWritingFalse(ODataVersion?version) { var options = new ODataSimplifiedOptions(version); options.SetOmitODataPrefix(false, ODataVersion.V401); Assert.Equal(version != null && version != ODataVersion.V4, options.GetOmitODataPrefix()); Assert.False(options.GetOmitODataPrefix(ODataVersion.V4)); Assert.False(options.GetOmitODataPrefix(ODataVersion.V401)); Assert.Equal(version != null && version != ODataVersion.V4, options.EnableWritingODataAnnotationWithoutPrefix); }
public void Validate401Options() { var options = new ODataSimplifiedOptions(ODataVersion.V401); options.EnableWritingKeyAsSegment.Should().BeFalse(); options.EnableReadingKeyAsSegment.Should().BeFalse(); options.EnableParsingKeyAsSegmentUrl.Should().BeTrue(); options.EnableReadingODataAnnotationWithoutPrefix.Should().BeTrue(); options.EnableWritingODataAnnotationWithoutPrefix.Should().BeTrue(); options.GetOmitODataPrefix().Should().BeTrue(); options.GetOmitODataPrefix(ODataVersion.V4).Should().BeFalse(); options.GetOmitODataPrefix(ODataVersion.V401).Should().BeTrue(); }
public void Validate401Options() { var options = new ODataSimplifiedOptions(ODataVersion.V401); Assert.False(options.EnableWritingKeyAsSegment); Assert.False(options.EnableReadingKeyAsSegment); Assert.True(options.EnableParsingKeyAsSegmentUrl); Assert.True(options.EnableReadingODataAnnotationWithoutPrefix); Assert.True(options.GetOmitODataPrefix()); Assert.True(options.GetOmitODataPrefix()); Assert.False(options.GetOmitODataPrefix(ODataVersion.V4)); Assert.True(options.GetOmitODataPrefix(ODataVersion.V401)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public virtual void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { var path = PlatformServices.Default.Application.ApplicationBasePath; if (!path.Contains("OData.Tests")) { //configure NLog loggerFactory.AddNLog(new NLogProviderOptions { CaptureMessageTemplates = true, CaptureMessageProperties = true }); loggerFactory.ConfigureNLog("nlog.config"); } if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } IEdmModel model = GetEdmModel(app.ApplicationServices); ODataSimplifiedOptions odata_options = new ODataSimplifiedOptions() { EnableWritingODataAnnotationWithoutPrefix = false }; app.UseCors(x => x.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins("*")); app.Map("/odata/api", api => { api.UseMvc(routeBuilder => { routeBuilder.Select().Expand().Filter().OrderBy().MaxTop(null).Count(); string odata_route_name = "ODataRoute"; routeBuilder.MapODataServiceRoute(odata_route_name, "data", a => { a.AddService(Microsoft.OData.ServiceLifetime.Singleton, sp => model); a.AddService <IODataPathHandler>(Microsoft.OData.ServiceLifetime.Singleton, sp => new DefaultODataPathHandler()); a.AddService <IEnumerable <IODataRoutingConvention> >( Microsoft.OData.ServiceLifetime.Singleton, sp => ODataRoutingConventions.CreateDefaultWithAttributeRouting(odata_route_name, routeBuilder)); a.AddService <ODataSerializerProvider>(Microsoft.OData.ServiceLifetime.Singleton, sp => new SampleODataSerializerProvider(sp, loggerFactory)); a.AddService <ODataDeserializerProvider>(Microsoft.OData.ServiceLifetime.Singleton, sp => new DefaultODataDeserializerProvider(sp)); a.AddService <ILoggerFactory>(Microsoft.OData.ServiceLifetime.Singleton, sp => loggerFactory); a.AddService <ODataSimplifiedOptions>(Microsoft.OData.ServiceLifetime.Singleton, sp => odata_options); a.AddService <ODataPayloadValueConverter, SampleODataPayloadValueConverter>(Microsoft.OData .ServiceLifetime.Singleton); }); routeBuilder.EnableDependencyInjection(); }); }); var webSocketOptions = new Microsoft.AspNetCore.Builder.WebSocketOptions() { KeepAliveInterval = TimeSpan.FromSeconds(5), ReceiveBufferSize = 999999 }; }