We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
Thanks :)
...
Thanks for the awesome tutorial. Very well article. I'm new for dotnet 7 days ago
Hi, thank you so much for your feedback.
That's great.
Regards
¿For what do you use public int? StockItemID { get; set; }
if in the database that data appears as not null?
Hi, this is a good question but requires a big explanation, please read this link:Entity Framework Core 2 for the Enterprise
Section Entity Layer - Keys
Regards
Thanks for the awesome tutorial 👍🏻 👍🏻 👍🏻
Thanks!
Greetings Carlo! Hats off! Very well drafted article. It shows you're a top professional.
Thank you for the elaborated technique and the clarity! 👍🏻
Thank you so much for your feedback.
Absolutely fantastic tutorial! Very good coverage of unit testing which is a huge plus.
Thank you so much for your feedback
Hello,
Could you provide an example of how to implement the test "Add a stock item without required fields"?
I'm having some problems because the method ModelState.IsValid() returns true when I pass NULL on a required field.
Hi.
In that case you can add another method in controller and use another model for request that fits with your requirements, please keep on mind You'll need to set default values for required columns that don't have values from request.
Regards
This is a great explanation. Is there a source code to download ?
this is so amazing, thanks for sharing your knowledge. It was very useful for me
A very good tutorial.
This is a really awesome tutorial and great helpful.
Can you provide me source code or Git hub link.?
Try and catch on every single method? Not sure if this is a good practise?
Hi, thank you so much for your comment.
You have a good point and that's correct but remember this is a guide for beginners and the point is show how to deal with errors in a simple way.
Maybe in one future version I'll add the use of global error handler.
Regards
Hi,
The code of the Entities.cs class can be self-generated or it is necessary to type the entire code.
Best regards
Hi.
In this case isn't necessary because We're working with an API for one entity (table), if You want to create an API for a couple of entities You can use scaffolding for Entity Framework Core.
Please read more information in this link: EF Core Tools & Extensions
Regards
This is a really good tutorial. But one concern, It seems the DB migration command missing in this tutorial. No need to do that? Or it is necessary?
Hi.
This tutorial uses Database-First approach, You're talking about Code-First approach.
Regards
Okay thanks.
Fantastic Tutorial especial Integration testing and unit testing
Hi CarloHerzl could you plz do a favour for me , can you use .NET Core and stored procedures to display the information in a table and running all crud in a table by creating buttons
Hi, thank you so much for your feedback.
Do you mean change this tutorial and use stored procedures?
Absolutely CarloHerzl please use stored procedures and .Net Core and also implement all the CRUD and use a controller to call all the CRUD form stored procedures . Your help would be highly appreciated
Can anyone tell me why I would get the following error in WarehouseController.cs
Line with Error: response.Model = await query.Paging(pageSize,pageNumber).ToListAsync();
Error: Severity Code Description Project File Line Suppression State
Error CS1061 'IQueryable<stockitem>' does not contain a definition for 'Paging' and no accessible extension method 'Paging' accepting a first argument of type 'IQueryable<stockitem>' could be found (are you missing a using directive or an assembly reference?) WideWorldImporters.API C:\Projects\WideWorldImporters.API\WideWorldImporters.API\Controllers\WarehouseController.cs 63 Active
Thank You!
You have missed to add the extension method, please make sure you have added IQueryableExtensions class in Extensions.cs file
WTF ?
Thank you.
Because you put as a requirement nodejs?
Hi Fernando.
You're right, NodeJS is not a requirement for this tutorial.
Regards
This is an awesome introduction to building web APIs with ASP.Net Core. It's straight-forward and easy to follow. Some issues I came across:
1. I had to configure `launchSettings.json` as follows:
`{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63166",
"sslPort": 0
}
},
"$schema": "http://json.schemastore.org...",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WideWorldImporters.API": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v1/Warehouse/StockItem",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
}
}
}`
I had to set launch URL for IIS Express and WideWorldImporters.API.
2. My connection string had to be "Data Source=(local);Initial Catalog=WideWorldImporters;Integrated Security=True".
3. (Suggestion) Make the code easier to copy and paste.
This is great and I look forward to learning more from you.
Thanks for this. It help me
What does it do? I always hit internal server error 500 for integration testing. And cannot extract specific error message. I cannot find a way to extract it from http client. Any suggestion?
I'm also getting the 500 server error. System.Net.Http.HttpRequestException : Response status code does not indicate success: 500 (Internal Server Error). It doesn't hit any more my break points Does anyone know of a solution or encounter something like this?
Thank you ! i was looking exactly for this. I just loved and used in my project.
public static IActionResult ToHttpResponse(this IResponse response) is there then ToHttpResponse is available for all the concrete who used this interface so if rather than extension method decides what httpstatus going to send can we pass it from response object ? if we do that than we dont have to wrtite 2 more overriders ?
i am still learning best practice but the architecture you are followed while defining models under namespace WideWorldImporters.API.Models, like inheriting from interfaces and generic, what purpose they solve ?
Hi.
IResponse represents a response with no model, We can use this response for Update and Delete actions because We don't need to return any value for client.
ISingleResponse<tmodel> represents a response with a model, for example StockItem; We can use this response for GetByID and Create actions because these responses need to have the StockItemID.
IListResponse<tmodel> and IPagedResponse<tmodel> represents a list response.
WideWorldImporters.API.Models namespace contains all definitions related to Web API, this guide is not about enterprise implementation so We have all definitions inside of same project.
A robust solution requires to have another project to place business logic and domain driven design but as I said before that design requires advanced skills in C#, you can read more about in: https://www.codeproject.com...
Let me know if this reply is useful.
Regards
I personally like this tutorial way more than what is provided by Microsoft, but I thought I'd link it here for anyone else who might be interested :)
Hi, thank you so much for your feedback.
I don't understand what do you mean with link it, can you provide me more information please.
Regards
Sorry for the confusion Carlo! I like your tutorial more than the Microsoft documentation / your tutorial is better.
But in case any other readers wanted to more information, I also provided the link (web address) to the Microsoft documentation here: https://docs.microsoft.com/...
I already added the link, thank you so much for your feedback.
Regards
This is a really good tutorial. I'm new to learning about Web API and I found this to be very clear and concise and have a solid working example that I can play around with.