diff --git a/src/.dockerignore b/src/.dockerignore deleted file mode 100644 index fe1152bdb8..0000000000 --- a/src/.dockerignore +++ /dev/null @@ -1,30 +0,0 @@ -**/.classpath -**/.dockerignore -**/.env -**/.git -**/.gitignore -**/.project -**/.settings -**/.toolstarget -**/.vs -**/.vscode -**/*.*proj.user -**/*.dbmdl -**/*.jfm -**/azds.yaml -**/bin -**/charts -**/docker-compose* -**/Dockerfile* -**/node_modules -**/npm-debug.log -**/obj -**/secrets.dev.yaml -**/values.dev.yaml -LICENSE -README.md -!**/.gitignore -!.git/HEAD -!.git/config -!.git/packed-refs -!.git/refs/heads/** \ No newline at end of file diff --git a/src/AspNetODataWithMarten/AspNetODataWithMarten.csproj b/src/AspNetODataWithMarten/AspNetODataWithMarten.csproj index 58e60e3242..5002a20063 100644 --- a/src/AspNetODataWithMarten/AspNetODataWithMarten.csproj +++ b/src/AspNetODataWithMarten/AspNetODataWithMarten.csproj @@ -9,7 +9,6 @@ - @@ -17,4 +16,10 @@ + + + ConnectionSource.cs + + + diff --git a/src/AspNetODataWithMarten/Dockerfile b/src/AspNetODataWithMarten/Dockerfile deleted file mode 100644 index 2cb0f32aec..0000000000 --- a/src/AspNetODataWithMarten/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base -USER app -WORKDIR /app -EXPOSE 5045 - -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src -COPY ["AspNetODataWithMarten/AspNetODataWithMarten.csproj", "AspNetODataWithMarten/"] -RUN dotnet restore "./AspNetODataWithMarten/AspNetODataWithMarten.csproj" -COPY . . -WORKDIR "/src/AspNetODataWithMarten" -RUN dotnet build "./AspNetODataWithMarten.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "./AspNetODataWithMarten.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "AspNetODataWithMarten.dll"] diff --git a/src/AspNetODataWithMarten/Program.cs b/src/AspNetODataWithMarten/Program.cs index 38dab869a2..7ac49b8af0 100644 --- a/src/AspNetODataWithMarten/Program.cs +++ b/src/AspNetODataWithMarten/Program.cs @@ -2,14 +2,18 @@ using Microsoft.AspNetCore.OData; using Microsoft.OData.ModelBuilder; using System.ComponentModel.DataAnnotations; +using Marten.Testing.Harness; var builder = WebApplication.CreateBuilder(args); +builder.WebHost.UseKestrel(serverOptions => +{ + serverOptions.ListenAnyIP(4000); +}); + builder.Services.AddMarten((options) => { - options.Connection(Environment.GetEnvironmentVariable("POSTGRES_CONNECTION_STRING")); - options.RegisterDocumentType(); - options.DatabaseSchemaName = "public"; + options.Connection(ConnectionSource.ConnectionString); }); builder.Services.AddControllers().AddOData(options => @@ -21,7 +25,7 @@ options.EnableQueryFeatures().AddRouteComponents("odata", entityBuilder.GetEdmModel()); }); - + var app = builder.Build(); app.MapControllers(); diff --git a/src/AspNetODataWithMarten/Properties/launchSettings.json b/src/AspNetODataWithMarten/Properties/launchSettings.json deleted file mode 100644 index 430eb641af..0000000000 --- a/src/AspNetODataWithMarten/Properties/launchSettings.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "profiles": { - "Container (Dockerfile)": { - "commandName": "Docker", - "launchBrowser": fa, - "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast", - "environmentVariables": { - "ASPNETCORE_HTTP_PORTS": "8080" - }, - "publishAllPorts": true - } - }, - "$schema": "http://json.schemastore.org/launchsettings.json" -} diff --git a/src/IssueService/Startup.cs b/src/IssueService/Startup.cs index 076fdedb0b..e1a6dcc820 100644 --- a/src/IssueService/Startup.cs +++ b/src/IssueService/Startup.cs @@ -62,8 +62,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "IssueService v1")); } - app.UseHttpsRedirection(); - app.UseRouting(); app.UseAuthorization(); diff --git a/src/LinqTests/Acceptance/where_clauses.cs b/src/LinqTests/Acceptance/where_clauses.cs index e5bdef0cc4..5293fe9f48 100644 --- a/src/LinqTests/Acceptance/where_clauses.cs +++ b/src/LinqTests/Acceptance/where_clauses.cs @@ -16,6 +16,8 @@ public where_clauses(DefaultQueryFixture fixture, ITestOutputHelper output) : ba static where_clauses() { + @where(x => (x.Number == 1) == true); + @where(x => x.Number == 1); @where(x => x.Number > 3); @where(x => x.Number < 3); diff --git a/src/Marten.sln b/src/Marten.sln index 3709da22be..cfc4a793cc 100644 --- a/src/Marten.sln +++ b/src/Marten.sln @@ -106,8 +106,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OData", "OData", "{93FC8079 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetODataWithMarten", "AspNetODataWithMarten\AspNetODataWithMarten.csproj", "{93298A4C-2B88-4EF3-9FC8-6B2AEF52F628}" EndProject -Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{0F9F373E-A47A-4028-AAEB-04E2FE4E7F24}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -254,10 +252,6 @@ Global {93298A4C-2B88-4EF3-9FC8-6B2AEF52F628}.Debug|Any CPU.Build.0 = Debug|Any CPU {93298A4C-2B88-4EF3-9FC8-6B2AEF52F628}.Release|Any CPU.ActiveCfg = Release|Any CPU {93298A4C-2B88-4EF3-9FC8-6B2AEF52F628}.Release|Any CPU.Build.0 = Release|Any CPU - {0F9F373E-A47A-4028-AAEB-04E2FE4E7F24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F9F373E-A47A-4028-AAEB-04E2FE4E7F24}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F9F373E-A47A-4028-AAEB-04E2FE4E7F24}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F9F373E-A47A-4028-AAEB-04E2FE4E7F24}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -297,7 +291,6 @@ Global {00DBDB5E-FE7B-4886-A989-181331DDD148} = {79961196-DB50-4AD3-B749-D231799BCF2E} {93FC8079-48C4-4D3B-8C17-3944A903674F} = {79961196-DB50-4AD3-B749-D231799BCF2E} {93298A4C-2B88-4EF3-9FC8-6B2AEF52F628} = {93FC8079-48C4-4D3B-8C17-3944A903674F} - {0F9F373E-A47A-4028-AAEB-04E2FE4E7F24} = {93FC8079-48C4-4D3B-8C17-3944A903674F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {52B7158F-0A24-47D9-9CF7-3FA94170041A} diff --git a/src/Marten/Linq/Parsing/WhereClauseParser.cs b/src/Marten/Linq/Parsing/WhereClauseParser.cs index a688b84998..36af5fb1cf 100644 --- a/src/Marten/Linq/Parsing/WhereClauseParser.cs +++ b/src/Marten/Linq/Parsing/WhereClauseParser.cs @@ -99,6 +99,16 @@ protected override Expression VisitBinary(BinaryExpression node) { if (_operators.TryGetValue(node.NodeType, out var op)) { + // This garbage is brought to you by oData + if (op == "=" && node is { Left: BinaryExpression binary, Right: ConstantExpression c } && + (c.Type == typeof(bool) || c.Type == typeof(bool?))) + { + if (true.Equals(c.Value)) + { + return VisitBinary(binary); + } + } + var left = new SimpleExpression(_members, node.Left); var right = new SimpleExpression(_members, node.Right);