-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
update project templates use primary constructors #59712
base: main
Are you sure you want to change the base?
Conversation
@danroth27 ping |
@Varorbc apologies for delay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution!
It looks great overall! The move to primary constructors here has revealed places where we were initializing but not using ILogger
s. I think it might be worthwhile to continue to inject ILogger's into the classes via the primary constructor but add code to use them in the class so that the functionality is properly demonstrated.
@@ -1,16 +1,9 @@ | |||
using Grpc.Core; | |||
using GrpcService_CSharp; | |||
|
|||
namespace GrpcService_CSharp.Services; | |||
|
|||
public class GreeterService : Greeter.GreeterBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Although the ILogger<GreeterService>
was unused before perhaps we can add a log to the SayHello
method to more fully demonstrate primary constructors here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I moved things to the main constructor, I noticed a bunch of log initializations that weren't being used, which caused our CI to fail. Since I wasn't sure what kind of logs should be output, I had no choice but to remove them for now. If you could provide the correct log outputs for each of the removed logs, that would be perfect.
@@ -9,7 +9,8 @@ | |||
|
|||
var app = builder.Build(); | |||
|
|||
var sampleTodos = new Todo[] { | |||
var sampleTodos = new Todo[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var sampleTodos = new Todo[] | |
Todo[] sampleTodos = [ |
Small nit unrelated to your contribution but while we're here perhaps we should update this to use collection expressions?
update project templates use primary constructors
Description
Fixes #52893