Skip to content
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

AspNetCore: Enable shorter Uris #508

Merged

Conversation

Daniel-Svensson
Copy link
Member

@Daniel-Svensson Daniel-Svensson commented Jun 5, 2024

Fix #507

Add a new Attribute for controlling how the Uri's for endpoints are generated and take it into account for both code generation.

  • BinaryHttpDomainClientFactory updates
    • The _httpClientFactory field now accepts a Uri parameter for HttpClient creation.
    • Updated DomainClientFactory so that it will only append "/binary/" for WCF style Uris, for all other kinds of uri it will

TODO

  • Review naming of all public methods (see RFC AspNetCore: Simple Urls #507 for name ideas)
    • The attribute
    • The enum
    • Should attribute be located in hosting or server assembly?
  • Should "AddDomainService" with a path be kept public ?
    • I think it makes some sense to allow multiple mappings for transparent failover
  • (manual) Testing
    • Code generation (T4 and normal)
    • Code generation, override per assembly
    • All 3 naming schemes
    • In test application
  • Update version number
  • Add changelog
  • Add soemthing to readme file
  • Change default to "WCF"

Copilot suggestions for names:
image

Daniel-Svensson and others added 9 commits April 26, 2024 09:28
Implemented a new feature to configure the pattern used for generating endpoint routes in domain services

The `AddDomainService(Type type)` method was modified to use the new `GetDomainServiceRoute(type)` method.

A new file `DomainServiceEndpointRoutePatternAttribute.cs` was added, defining the `EndpointRoutePattern` enum and the `DomainServiceEndpointRoutePatternAttribute` attribute. The `GenerateConstructors()` method in `CSharpDomainContextGenerator.cs` and `CSharpDomainContextGenerator.tt` was modified to use the new `GetDomainServiceUri()` method.

A new method `GetDomainServiceUri()` was added to `CSharpDomainContextGenerator.partial.cs` and `DomainServiceProxyGenerator.cs`. The `ClientCodeGenerationDispatcher.cs` and `ClientCodeGenerationOptions.cs` were modified to load and set the `DefaultEndpointRoutePattern` option. The `DomainServiceProxyGenerator.cs` was modified to use the new `GetDomainServiceUri()` method.

A new file `EndpointRoutePattern.cs` was added, defining the `EndpointRoutePattern` enum. The `Program.cs` was modified to set the `DomainServiceEndpointRoutePattern` attribute for the assembly to `EndpointRoutePattern.WCF`.
Updated the `BinaryHttpDomainClientFactory` class in the `OpenRiaServices.Client.DomainClients` namespace. The `_httpClientFactory` field now accepts a `Uri` parameter for `HttpClient` creation.

Updated `DomainClientFactory` so that it will only append "/binary/" for WCF style Uris, for all other kinds of uri it will ensure there is a trailing "/" instead.

Add special workaround for AspNetCore tests so that they use the "Fullname" endpoint pattern even though the client is generated to use WCF style pattern.
@Daniel-Svensson Daniel-Svensson marked this pull request as ready for review June 5, 2024 13:43
@Daniel-Svensson Daniel-Svensson requested a review from a team June 5, 2024 13:46
@Daniel-Svensson Daniel-Svensson added this to the 5.5.0 milestone Jun 11, 2024
Copy link

sonarcloud bot commented Jun 12, 2024

@Daniel-Svensson Daniel-Svensson merged commit 705d5ae into OpenRIAServices:main Jun 12, 2024
4 checks passed
@Daniel-Svensson Daniel-Svensson deleted the feature/small_uri branch June 12, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC AspNetCore: Simple Urls
2 participants