-
Notifications
You must be signed in to change notification settings - Fork 388
Add .net 10 as a target framework #1170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KaptenJon
wants to merge
11
commits into
DigDes:develop
Choose a base branch
from
KaptenJon:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+883
−125
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0b1ec17
Upgrade to .net 10
095d6a8
Add using for disposable objects
c358005
Remove warnings
37c239c
add .net 10 to benchmark
0f58cec
remove deprechated aspnet3.1 still partly supported by netstandard2.0
7631e9e
Fix warnings stylecop
7663cac
Remove warnings from style cop
7736034
Update samples/Net10Client/SampleService.cs
KaptenJon d50a5ae
Update src/SoapCore/MembersWithAttributeCache.cs
KaptenJon 6d64ded
Adjust namespace
9cddc8a
rm warning
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <OutputType>Exe</OutputType> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="System.ServiceModel.Duplex" Version="6.0.*" /> | ||
| <PackageReference Include="System.ServiceModel.Federation" Version="10.0.*" /> | ||
| <PackageReference Include="System.ServiceModel.Http" Version="10.0.*" /> | ||
| <PackageReference Include="System.ServiceModel.NetTcp" Version="10.0.*" /> | ||
| <PackageReference Include="System.ServiceModel.Security" Version="6.0.*" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Models\Models.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.ServiceModel; | ||
| using Models; | ||
|
|
||
| namespace Net10Client | ||
| { | ||
| public class Program | ||
| { | ||
| public static void Main() | ||
| { | ||
| Console.WriteLine("NET 10 Client - Connecting to SOAP service..."); | ||
|
|
||
| var binding = new BasicHttpBinding(); | ||
| var endpoint = new EndpointAddress(new Uri($"http://{Environment.MachineName}:5060/Service.svc")); | ||
| using var channelFactory = new ChannelFactory<ISampleService>(binding, endpoint); | ||
| var serviceClient = channelFactory.CreateChannel(); | ||
|
|
||
| try | ||
| { | ||
| var result = serviceClient.Ping("Hello from NET 10 Client"); | ||
| Console.WriteLine("Ping method result: {0}", result); | ||
|
|
||
| var complexModel = new ComplexModelInput | ||
| { | ||
| StringProperty = Guid.NewGuid().ToString(), | ||
| IntProperty = int.MaxValue / 2, | ||
| ListProperty = new List<string> { "NET", "10", "test", "list" }, | ||
| DateTimeOffsetProperty = new DateTimeOffset(2024, 12, 31, 13, 59, 59, TimeSpan.FromHours(1)) | ||
| }; | ||
|
|
||
| var complexResult = serviceClient.PingComplexModel(complexModel); | ||
| Console.WriteLine("PingComplexModel result. FloatProperty: {0}, StringProperty: {1}, ListProperty: {2}, DateTimeOffsetProperty: {3}, EnumProperty: {4}", | ||
| complexResult.FloatProperty, complexResult.StringProperty, string.Join(", ", complexResult.ListProperty), | ||
| complexResult.DateTimeOffsetProperty, complexResult.TestEnum); | ||
|
|
||
| serviceClient.VoidMethod(out var stringValue); | ||
| Console.WriteLine("Void method result: {0}", stringValue); | ||
|
|
||
| var asyncMethodResult = serviceClient.AsyncMethod().Result; | ||
| Console.WriteLine("Async method result: {0}", asyncMethodResult); | ||
|
|
||
| var xmlElement = System.Xml.Linq.XElement.Parse("<test>NET 10 string</test>"); | ||
| serviceClient.XmlMethod(xmlElement); | ||
| Console.WriteLine("XmlMethod executed successfully"); | ||
|
|
||
| var complexReturnModels = serviceClient.ComplexReturnModel(); | ||
| Console.WriteLine("ComplexReturnModel results:"); | ||
| foreach (var model in complexReturnModels) | ||
| { | ||
| Console.WriteLine(" Id: {0}, Name: {1}", model.Id, model.Name); | ||
| } | ||
|
|
||
| Console.WriteLine("\nAll tests completed successfully!"); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine("Error: {0}", ex.Message); | ||
| } | ||
|
|
||
| Console.WriteLine("\nPress any key to exit..."); | ||
| Console.ReadKey(); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| using Models; | ||
| using System.Xml.Linq; | ||
|
|
||
| namespace Net10Client | ||
| { | ||
| public class SampleService : ISampleService | ||
| { | ||
| public string Ping(string s) | ||
| { | ||
| Console.WriteLine("NET 10 Server - Exec ping method"); | ||
| return $"NET 10 Response: {s}"; | ||
| } | ||
|
|
||
| public ComplexModelResponse PingComplexModel(ComplexModelInput inputModel) | ||
| { | ||
| Console.WriteLine("NET 10 Server - Input data. IntProperty: {0}, StringProperty: {1}", | ||
| inputModel.IntProperty, inputModel.StringProperty); | ||
|
|
||
| return new ComplexModelResponse | ||
| { | ||
| FloatProperty = float.MaxValue / 2, | ||
| StringProperty = inputModel.StringProperty, | ||
| ListProperty = inputModel.ListProperty, | ||
| DateTimeOffsetProperty = inputModel.DateTimeOffsetProperty | ||
| }; | ||
| } | ||
|
|
||
| public int[] IntArray() | ||
| { | ||
| return new int[] { 123, 456, 789 }; | ||
| } | ||
|
|
||
| public void VoidMethod(out string s) | ||
| { | ||
| s = "Value from NET 10 server"; | ||
| } | ||
|
|
||
| public Task<int> AsyncMethod() | ||
| { | ||
| return Task.FromResult(42); | ||
| } | ||
|
|
||
| public int? NullableMethod(bool? arg) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| public void XmlMethod(XElement xml) | ||
| { | ||
| Console.WriteLine("NET 10 Server - XML: {0}", xml); | ||
| } | ||
|
|
||
| public ComplexReturnModel[] ComplexReturnModel() | ||
| { | ||
| return new ComplexReturnModel[] | ||
| { | ||
| new ComplexReturnModel { Id = 1, Name = "NET 10 Item 1" }, | ||
| new ComplexReturnModel { Id = 2, Name = "NET 10 Item 2" } | ||
| }; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # .NET 10 SoapCore Sample | ||
|
|
||
| This sample demonstrates how to use SoapCore with .NET 10, showcasing both a SOAP server and client implementation. | ||
|
|
||
| ## Projects | ||
|
|
||
| ### Net10Server | ||
| A .NET 10 web application that hosts a SOAP service using SoapCore. | ||
|
|
||
| - **Port**: 5060 | ||
| - **Endpoints**: | ||
| - `/Service.svc` - DataContractSerializer endpoint | ||
| - `/Service.asmx` - XmlSerializer endpoint | ||
|
|
||
| ### Net10Client | ||
| A .NET 10 console application that consumes the SOAP service. | ||
|
|
||
| ## Running the Sample | ||
|
|
||
| 1. **Start the Server**: | ||
| ```bash | ||
| cd Net10Server | ||
| dotnet run | ||
| ``` | ||
|
|
||
| 2. **Run the Client** (in a separate terminal): | ||
| ```bash | ||
| cd Net10Client | ||
| dotnet run | ||
| ``` | ||
|
|
||
| ## Features Demonstrated | ||
|
|
||
| - Basic string operations (Ping) | ||
| - Complex model serialization/deserialization | ||
| - Void methods with out parameters | ||
| - Async methods | ||
| - XML element handling | ||
| - Array return types | ||
| - Nullable types | ||
|
|
||
| ## Key Differences from Previous Samples | ||
|
|
||
| - Uses modern .NET 10 hosting model with `IHostBuilder` | ||
| - Updated to use System.ServiceModel 8.0.* packages for better .NET 10 compatibility | ||
| - Demonstrates implicit usings and nullable reference types | ||
| - Uses a different port (5060) to avoid conflicts with other sample projects | ||
|
|
||
| ## Requirements | ||
|
|
||
| - .NET 10 SDK | ||
| - SoapCore library | ||
| - Models project (shared across all samples) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\src\SoapCore\SoapCore.csproj" /> | ||
| <ProjectReference Include="..\Models\Models.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| using Microsoft.AspNetCore.Hosting; | ||
| using Microsoft.Extensions.Hosting; | ||
| using Microsoft.Extensions.Logging; | ||
|
|
||
| namespace Net10Server | ||
| { | ||
| public class Program | ||
| { | ||
| public static void Main(string[] args) | ||
| { | ||
| CreateHostBuilder(args).Build().Run(); | ||
| } | ||
|
|
||
| public static IHostBuilder CreateHostBuilder(string[] args) => | ||
| Host.CreateDefaultBuilder(args) | ||
| .ConfigureWebHostDefaults(webBuilder => | ||
| { | ||
| webBuilder.UseStartup<Startup>(); | ||
| webBuilder.UseUrls("http://*:5060"); | ||
| }) | ||
| .ConfigureLogging(logging => | ||
| { | ||
| logging.AddDebug(); | ||
| logging.AddConsole(); | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "profiles": { | ||
| "Net10Server": { | ||
| "commandName": "Project", | ||
| "launchBrowser": false, | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| }, | ||
| "applicationUrl": "http://localhost:5060" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| using Models; | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using System.Xml.Linq; | ||
|
|
||
| namespace Net10Server | ||
| { | ||
| public class SampleService : ISampleService | ||
| { | ||
| public string Ping(string s) | ||
| { | ||
| Console.WriteLine("NET 10 Server - Exec ping method"); | ||
| return $"NET 10 Response: {s}"; | ||
KaptenJon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public ComplexModelResponse PingComplexModel(ComplexModelInput inputModel) | ||
| { | ||
| Console.WriteLine("NET 10 Server - Input data. IntProperty: {0}, StringProperty: {1}", | ||
KaptenJon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| inputModel.IntProperty, inputModel.StringProperty); | ||
|
|
||
| return new ComplexModelResponse | ||
| { | ||
| FloatProperty = float.MaxValue / 2, | ||
| StringProperty = inputModel.StringProperty, | ||
| ListProperty = inputModel.ListProperty, | ||
| DateTimeOffsetProperty = inputModel.DateTimeOffsetProperty | ||
| }; | ||
| } | ||
|
|
||
| public int[] IntArray() | ||
| { | ||
| return [123, 456, 789]; | ||
| } | ||
|
|
||
| public void VoidMethod(out string s) | ||
| { | ||
| s = "Value from NET 10 server"; | ||
| } | ||
|
|
||
| public Task<int> AsyncMethod() | ||
| { | ||
| return Task.FromResult(42); | ||
| } | ||
|
|
||
| public int? NullableMethod(bool? arg) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| public void XmlMethod(XElement xml) | ||
| { | ||
| Console.WriteLine("NET 10 Server - XML: {0}", xml); | ||
| } | ||
|
|
||
| public ComplexReturnModel[] ComplexReturnModel() | ||
| { | ||
| return [ | ||
| new ComplexReturnModel { Id = 1, Name = "NET 10 Item 1" }, | ||
| new ComplexReturnModel { Id = 2, Name = "NET 10 Item 2" } | ||
| ]; | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.