How to set address if in case Address is a separate class means address field of User is of type Address. Address class may have fields like StreetNumber, Street, City etc.
@William Liu, I guess you can use init for creating an immutable property. I am not 100% sure how it will work in this scenario, I will have to try it out and see.
This was a good intro, but I believe creating the user object in the builder constructor was a mistake. Better to create the user object in the build function, that way you don't have to list all the user properties twice in the builder, and you can keep private setters in the user class itself.
just create a interface for the builder and use register it in the ICO not the class itself, so you can use the class in the client or in the api to get the values or assign them in the api not in the registration
It's a layman explanation. Thanks for sharing
that was the simplest and clearest explanation of the pattern. good job.
Thanks
How to set address if in case Address is a separate class means address field of User is of type Address. Address class may have fields like StreetNumber, Street, City etc.
All clear, thanks so much for you excellent explain
Thanks
Simple explanation thanks
You are welcome
Thanks much. It would be helpful If you starts the session for Azure or CI/CD pipeline integration...
@Mahendran Chinnaiah, thanks for watching! I will definitely start on Azure in the coming week.
Thanks! That`s simple and easy to understand! One more question, can I use the "init accessor" from C#9 instead if I want the immutable properties?
@William Liu, I guess you can use init for creating an immutable property. I am not 100% sure how it will work in this scenario, I will have to try it out and see.
This was a good intro, but I believe creating the user object in the builder constructor was a mistake. Better to create the user object in the build function, that way you don't have to list all the user properties twice in the builder, and you can keep private setters in the user class itself.
"services.AddSingleton" what it is?
This is for adding service into dependency injection container
I think this is part of the dotnet web api start up project. Checkout dotnet web apis and checkout singleton pattern.
Nice vídeo!
Thanks!
Sometimes it look some patterns are over complex with no reason to use
just create a interface for the builder and use register it in the ICO not the class itself, so you can use the class in the client or in the api to get the values or assign them in the api not in the registration