Skip to content

Commit

Permalink
Merge pull request #195 from microsoft/chgeuer/net8.0
Browse files Browse the repository at this point in the history
Move from .NET 7.0 to .NET 8.0
  • Loading branch information
chgeuer authored Jan 9, 2024
2 parents 44c211f + 8481e87 commit a3ac59a
Show file tree
Hide file tree
Showing 34 changed files with 127 additions and 128 deletions.
2 changes: 1 addition & 1 deletion scripts/Metering.SharedResourceBroker/isv-backend.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ resource appService 'Microsoft.Web/sites@2021-03-01' = {
minTlsVersion: '1.2'
netFrameworkVersion: windowsInstance ? 'v7.0' : null
linuxFxVersion: windowsInstance ? null : 'DOTNETCORE|7.0' // This is only for Linux *containers*
// windowsFxVersion: 'dotnet:7' // This is for Windows *containers* (code-name Xenon)
// windowsFxVersion: 'dotnet:8' // This is for Windows *containers* (code-name Xenon)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
7 changes: 3 additions & 4 deletions src/Aggregator/Aggregator.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Targets" Version="5.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Metering.EventHub\Metering.EventHub.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions src/AggregatorFunctionHost/AggregatorFunctionHost.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Metering.EventHub\Metering.EventHub.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Demos/DemoClient/DemoClient.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<!--<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
Expand Down
2 changes: 1 addition & 1 deletion src/Demos/DemoDownloadCapture/DemoDownloadCapture.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Demos/DemoWebApp/DemoWebApp.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
<DockerComposeProjectPath>..\..\docker-compose\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Metering.Runtime\Metering.Runtime.fsproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Metering.BaseTypes\Metering.BaseTypes.fsproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<WarnOn>3390;$(WarnOn)</WarnOn>
</PropertyGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="7.0.0" />
<PackageReference Update="FSharp.Core" Version="8.0.100" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Metering.Runtime\Metering.Runtime.fsproj" />
Expand Down
16 changes: 8 additions & 8 deletions src/Demos/SaaSIntegration/src/LandingPage/LandingPage.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Marketplace.SaaS.Client" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.1" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="7.0.1" NoWarn="NU1605" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.25.10" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="1.25.10" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.25.10" />
<PackageReference Include="Marketplace.SaaS.Client" Version="1.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.16.0" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="2.16.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="2.16.0" />
</ItemGroup>
</Project>
13 changes: 6 additions & 7 deletions src/Demos/SaaSIntegration/src/MeteredPage/MeteredPage.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="7.0.1" NoWarn="NU1605" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.25.10" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="1.25.10" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.25.10" />

<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.16.0" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="2.16.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="2.16.0" />
<!--
<PackageReference Include="Marketplace.SaaS.Client" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" NoWarn="NU1605" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
-->
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Metering.BaseTypes\Metering.BaseTypes.fsproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Demos/SimpleSerialization/SimpleSerialization.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<!--<Nullable>enable</Nullable>-->
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Dockerfile.Aggregator
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Aggregator/Aggregator.csproj", "Aggregator/"]
RUN dotnet restore "Aggregator/Aggregator.csproj"
Expand Down
4 changes: 2 additions & 2 deletions src/Metering.BaseTypes/Meter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ module Meter =
let mStr =
m.Subscription.Plan.BillingDimensions
|> Map.toSeq
|> Seq.map (fun (k,v) -> v)
|> Seq.map (fun (_k,v) -> v)
|> Seq.map (sprintf "%A")
|> Seq.map (fun v -> $"{pid} {m.Subscription.MarketplaceResourceId.ToString()}: {v}")
|> String.concat "\n"

let uStr =
m.UsageToBeReported
|> Seq.map (fun a -> a.ToString())
|> Seq.map _.ToString()
|> String.concat "\n"

$"{mStr}\n{uStr}"
4 changes: 2 additions & 2 deletions src/Metering.BaseTypes/MeterCollection.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type MeterCollection =

member this.MetersToBeSubmitted() : MarketplaceRequest seq =
this.Meters
|> Seq.collect (fun meter -> meter.UsageToBeReported)
|> Seq.collect _.UsageToBeReported

static member Empty
with get() =
Expand All @@ -38,7 +38,7 @@ module MeterCollection =

let toStrM (pid) (meters: Meter seq) : string =
meters
|> Seq.sortBy (fun a -> a.Subscription.MarketplaceResourceId)
|> Seq.sortBy _.Subscription.MarketplaceResourceId
|> Seq.map (Meter.toStr pid)
|> String.concat "\n-----------------\n"

Expand Down
4 changes: 2 additions & 2 deletions src/Metering.BaseTypes/MeterCollectionLogic.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ open Metering.BaseTypes.EventHub
[<Extension>]
module MeterCollectionLogic =
let lastUpdate (mc: MeterCollection option) : MessagePosition option =
mc |> Option.bind (fun m -> m.LastUpdate)
mc |> Option.bind _.LastUpdate

[<Extension>]
let getEventPosition (someMeterCollection: MeterCollection option) : StartingPosition =
Expand All @@ -32,7 +32,7 @@ module MeterCollectionLogic =
/// Returns all MarketplaceRequests that are ready to be sent to the Marketplace Metering API
let usagesToBeReported (meterCollection: MeterCollection) : MarketplaceRequest list =
meterCollection.Meters
|> List.map (fun x -> x.UsageToBeReported)
|> List.map _.UsageToBeReported
|> List.concat

/// Ensure that we apply the right event at the right time, belonging to the appropriate partition
Expand Down
8 changes: 4 additions & 4 deletions src/Metering.BaseTypes/Metering.BaseTypes.fsproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarnOn>3390;$(WarnOn)</WarnOn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NodaTime" Version="3.1.6" />
<PackageReference Include="Thoth.Json.Net" Version="10.0.0" />
<PackageReference Include="NodaTime" Version="3.1.10" />
<PackageReference Include="Thoth.Json.Net" Version="11.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="7.0.0" />
<PackageReference Update="FSharp.Core" Version="8.0.100" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Metering.EventHubTypes\Metering.EventHubTypes.fsproj" />
Expand Down
4 changes: 2 additions & 2 deletions src/Metering.BaseTypes/SimpleBilling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type ConsumedQuantity =

override this.ToString() = sprintf "%s consumed this hour, %s in total" (this.CurrentHour.ToString()) (this.BillingPeriodTotal.ToString())

member this.increaseConsumption now amount = { this with CurrentHour = this.CurrentHour + amount; BillingPeriodTotal = this.BillingPeriodTotal + amount; LastUpdate = now }
member this.increaseConsumption now amount = { CurrentHour = this.CurrentHour + amount; BillingPeriodTotal = this.BillingPeriodTotal + amount; LastUpdate = now }

member this.accountExpiredSubmission now amount = { this with CurrentHour = this.CurrentHour + amount; LastUpdate = now }

Expand All @@ -30,7 +30,7 @@ type IncludedQuantity =

override this.ToString() = sprintf "Remaining %s" (this.RemainingQuantity.ToString())

member this.decrease now amount = { this with RemainingQuantity = this.RemainingQuantity - amount; BillingPeriodTotal = this.BillingPeriodTotal + amount; LastUpdate = now }
member this.decrease now amount = { RemainingQuantity = this.RemainingQuantity - amount; BillingPeriodTotal = this.BillingPeriodTotal + amount; LastUpdate = now }

//static member createNew now remainingQuantity = { RemainingQuantity = remainingQuantity; BillingPeriodTotal = Quantity.Zero; LastUpdate = now }

Expand Down
21 changes: 12 additions & 9 deletions src/Metering.BaseTypes/WaterfallBilling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ type WaterfallModelRow =
type WaterfallExpandedModel =
WaterfallModelRow list

type WaterfallConsumption =
Map<DimensionId, Quantity>

type WaterfallMeterValue =
{ Total: Quantity
Consumption: Map<DimensionId, Quantity>
Consumption: WaterfallConsumption
LastUpdate: MeteringDateTime }
with static EmptyConsumption : WaterfallConsumption = Map.empty<DimensionId, Quantity>

/// These must be reported
type ConsumptionReport =
Expand All @@ -36,7 +40,7 @@ type ConsumptionReport =
type SubtractionAggregation =
{ CurrentTotal: Quantity
AmountToBeDeducted: Quantity
Consumption: Map<DimensionId, Quantity> }
Consumption: WaterfallConsumption }

/// Serialization
type WaterfallBillingDimensionItem =
Expand All @@ -63,17 +67,17 @@ module WaterfallMeterLogic =
{ Threshold =
waterfallTiers
|> List.take (i + 1)
|> List.sumBy (fun x -> x.Threshold)
|> List.sumBy _.Threshold
DimensionId =
waterfallTiers
|> List.skip(i)
|> List.head
|> fun x -> x.DimensionId })
|> _.DimensionId })

let included =
expanded
|> List.head
|> fun x -> x.Threshold
|> _.Threshold
|> FreeIncluded

let ranges =
Expand Down Expand Up @@ -147,10 +151,9 @@ module WaterfallMeterLogic =
|> findRange meter.Total
|> List.fold subtract { CurrentTotal = meter.Total; AmountToBeDeducted = amount; Consumption = meter.Consumption }
|> fun agg ->
{ meter with
Total = agg.CurrentTotal
Consumption = agg.Consumption
LastUpdate = now }
{ WaterfallMeterValue.Total = agg.CurrentTotal
Consumption = agg.Consumption
LastUpdate = now }

let accountExpiredSubmission (dimensionId: DimensionId) (waterfallDimension: WaterfallBillingDimension) (now: MeteringDateTime) (amount: Quantity) (meter: WaterfallMeterValue) : WaterfallMeterValue =
let newConsumption = meter.Consumption |> Map.change dimensionId (add amount)
Expand Down
10 changes: 5 additions & 5 deletions src/Metering.EventHub/Metering.EventHub.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FSharp.Control.AsyncSeq" Version="3.2.1" />
<PackageReference Include="System.Reactive.Linq" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.7.5" />
<PackageReference Include="Azure.Messaging.EventHubs.Processor" Version="5.7.5" />
<PackageReference Include="System.Reactive.Linq" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.10.0" />
<PackageReference Include="Azure.Messaging.EventHubs.Processor" Version="5.10.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Metering.EventHubTypes\Metering.EventHubTypes.fsproj" />
Expand Down
6 changes: 3 additions & 3 deletions src/Metering.EventHubTypes/Metering.EventHubTypes.fsproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NodaTime" Version="3.1.6" />
<PackageReference Include="NodaTime" Version="3.1.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="7.0.0" />
<PackageReference Update="FSharp.Core" Version="8.0.100" />
</ItemGroup>
<ItemGroup>
<Compile Include="FSharpFuncUtil.fs" />
Expand Down
Loading

0 comments on commit a3ac59a

Please sign in to comment.