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

Refactor(MinimalAPI): Refactor MinimalAPIs #238

Merged
merged 7 commits into from
Sep 15, 2022
Merged

Conversation

zhenlei520
Copy link
Contributor

Description

Refactor MinimalAPIs

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Sorry, something went wrong.

@zhenlei520 zhenlei520 requested a review from doddgu September 14, 2022 01:16
{
public string? Pattern { get; set; }

public string? Method { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string -> HttpMethod

[AttributeUsage(AttributeTargets.Method)]
public class IncludeMappingAttribute : Attribute
{
public string? Pattern { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pattern? It's need a commet and sample. For example regex?

@@ -1,15 +1,20 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove a blank line

}

#endregion
internal void AutoMapRouter()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutoMapRoute, and it will support map group for .net 7.

{
var type = GetType();

var methods = type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing distinct?

if (methodName.StartsWith("Add", StringComparison.OrdinalIgnoreCase) ||
methodName.StartsWith("Upsert", StringComparison.OrdinalIgnoreCase)) return "POST";

if (methodName.StartsWith("Update", StringComparison.OrdinalIgnoreCase)) return "PUT";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update and Modify

public string? Version { get; set; }

/// <summary>
/// service name, defaults to null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why sometimes start with lowercase?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaults to?

public class Url
{
/// <summary>
/// The prefix, the default is null, consistent with the global prefix, if it is string.Empty, the Prefix is ignored
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatter is $"{Prefix}/{Version}/{ServiceName}", any one IsNullOrWhiteSpace would be ignored.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 12 Code Smells

89.1% 89.1% Coverage
5.6% 5.6% Duplication

Copy link
Contributor

@doddgu doddgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@doddgu doddgu merged commit 1a36c1c into main Sep 15, 2022
@doddgu doddgu deleted the feature/minimal_api branch September 15, 2022 01:41
@zhenlei520 zhenlei520 mentioned this pull request Sep 16, 2022
11 tasks
@zhenlei520 zhenlei520 added this to the 0.6.0 milestone Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Minimal APIs ServiceBase Refactor Minimal APIs support auto map for RESTful
2 participants