Comments on: Entity Framework Core – Getting Started https://code-maze.com/entity-framework-core-getting-started/ Learn. Code. Succeed. Thu, 22 Sep 2022 10:59:55 +0000 hourly 1 https://wordpress.org/?v=6.7.5 By: Marinko https://code-maze.com/entity-framework-core-getting-started/#comment-3662 Sat, 22 May 2021 09:01:05 +0000 https://code-maze.com/?p=48543#comment-3662 In reply to Eo Raptor.

Honestly it would be much easier if you could share your GitHub repo or code sample. I am not sure what is the problem just from the description you provided.

]]>
By: Eo Raptor https://code-maze.com/entity-framework-core-getting-started/#comment-3659 Fri, 21 May 2021 21:02:55 +0000 https://code-maze.com/?p=48543#comment-3659 My ef Core 5 rest api is much like yours except its about hourly workers and timecards. My configuration in Startup.cs is just like yours. My derived DbContext class has the DbContextOptions constructor with base. But, when I debug, the application fails on the derived class not having a construction string. So, DoI doesn’t work, apparently? My derived class is added to the services, uses sql server, and gets the connection string by way of the Startup configuration.

Do I completely misunderstand DoI, EntityFrameworkCore 5, or some basic coding feature?

Any help would be greatly appreciated.

Thanks.

]]>
By: Kevin Weidner https://code-maze.com/entity-framework-core-getting-started/#comment-2617 Wed, 04 Nov 2020 13:36:56 +0000 https://code-maze.com/?p=48543#comment-2617 In reply to Marinko.

OK, thanks – you answered the part about performance and memory – good to know. I like the concept, I just have always used ints without thinking about it much, but I do see an advantage. It is a bit curious that for the Id field in the AspNetUsers table, Microsoft chose to use nvarchar(450) instead of an int or guid.

]]>
By: Marinko https://code-maze.com/entity-framework-core-getting-started/#comment-2604 Fri, 30 Oct 2020 04:25:52 +0000 https://code-maze.com/?p=48543#comment-2604 In reply to Kevin Weidner.

Hi Kevin. Well, I am not sure if itnis a best practice, I don’t think so, but nevertheless I always used guids in my large projects and never had a single speed or memory problem. Yes, INT is smaller, but again, as I said, it works and it worked for me like a charm. I wouldn’t go here in pros and cons, you can find a lot abot that on Google, but I trust my expirience 🙂

]]>
By: Kevin Weidner https://code-maze.com/entity-framework-core-getting-started/#comment-2603 Thu, 29 Oct 2020 17:00:41 +0000 https://code-maze.com/?p=48543#comment-2603 Hi Marinko,

I see you use the Guid datatype for primary keys and I do see a case for this. Is this Microsoft best practice? Aren’t ints faster than Guids (strings) and since they are PKs, they are used often in joins and you’d want the faster performance.

Thank you.

]]>
By: Kevin Weidner https://code-maze.com/entity-framework-core-getting-started/#comment-2577 Thu, 15 Oct 2020 13:53:24 +0000 https://code-maze.com/?p=48543#comment-2577 In reply to Marinko.

Sounds good.

]]>
By: Marinko https://code-maze.com/entity-framework-core-getting-started/#comment-2576 Thu, 15 Oct 2020 13:27:15 +0000 https://code-maze.com/?p=48543#comment-2576 In reply to Kevin Weidner.

No, we don’t have a hard copy. But it is not strictly online, once you buy it, it is yours with all the source code and bonuses.

]]>
By: Kevin Weidner https://code-maze.com/entity-framework-core-getting-started/#comment-2575 Thu, 15 Oct 2020 13:10:59 +0000 https://code-maze.com/?p=48543#comment-2575 In reply to Marinko.

Thanks for pointing me in the right direction, Marinko. Just curious – is your book strictly online – no hard copy, right?

]]>
By: Marinko https://code-maze.com/entity-framework-core-getting-started/#comment-2570 Wed, 14 Oct 2020 13:36:05 +0000 https://code-maze.com/?p=48543#comment-2570 In reply to Kevin Weidner.

Hello Kevin. Thank you for the comment and for the support. About environment variables – This is much safer way of storing sensitive data, because you are not exposing them in a file such as appsettings.json which is deployed to the server. With env variables you can store your data on the machine itself and only your software can access it. You can see one example in the lunchsettins.json file in asp.net core project. There you have :

“environmentVariables”: {
“ASPNETCORE_ENVIRONMENT”: “Development”
}

which sets this variable to the Development value. Of course, you don’t have to create it like this. You can use the command window to generate and populate env variable and then just use it in your app.

In our Ultimate ASP.NET Core Web API book, we have a great example of using env variable for the authentication with JWT.

]]>
By: Kevin Weidner https://code-maze.com/entity-framework-core-getting-started/#comment-2569 Wed, 14 Oct 2020 10:47:54 +0000 https://code-maze.com/?p=48543#comment-2569 Hi Marinko,

I’m reading where you say:

But, we must state that using appsettings files to store connection string (or other sensitive data) isn’t the best practice, especially for the production environment. In such a case, the better way is to use environment variables.

I’m must not exactly sure what you mean by “environment variables” – can you provide an example?
Thanks very much for this great EF series!

]]>