IAmTimCorey
IAmTimCorey
  • 655
  • 39 298 537
Accessing AppSettings in Console Apps Including Secrets.json
Console apps are incredibly useful. From running simple applications to executing automated tasks, Console apps are a really valuable application type. However, they don't come with any existing code, which means you need to build out anything you want. One common feature developers end up wanting is access to a settings file. In this video, I am going to show you how to add an appsettings.json file and a user secrets file to your console app. We will go over how to set it up, how to access the data inside of it, and what the best practices are around using these files.
Full Training Courses: IAmTimCorey.com
Source Code: leadmagnets.app/?Resource=AppSettingsInConsoleApps
Переглядів: 5 663

Відео

When To Break The Rules as a Developer
Переглядів 2,6 тис.12 годин тому
When do I break the rules as a developer? How do I know when I should implement a pattern or intentionally ignore it? Should I ever violate SOLID or DRY? These are the questions we will answer in today's episode of Dev Questions. Website: www.iamtimcorey.com/ Patreon: www.patreon.com/IAmTimCorey Ask Your Question: suggestions.iamtimcorey.com/ Sign Up to Get More Great Developer Content in Your ...
New Extension Manager in Visual Studio 2022 v17.10
Переглядів 5 тис.19 годин тому
There is a new extension manager in Visual Studio. In this video, we are going to look at what has changed as well as how to enable or disable it. Full Training Courses: IAmTimCorey.com
When JavaScript Becomes Important for C# Developers
Переглядів 4,8 тис.День тому
Do I need to know JavaScript as a C# developer? Do I need to know JavaScript if I know Blazor? Do I need to know JavaScript if I already know Angular or React? These are the questions we will answer in today's episode of Dev Questions. Website: www.iamtimcorey.com/ Patreon: www.patreon.com/IAmTimCorey Ask Your Question: suggestions.iamtimcorey.com/ Sign Up to Get More Great Developer Content in...
Centering With CSS The Easy Way
Переглядів 3,5 тис.14 днів тому
For years, the running joke has been that centering an object on a web page is hard. With modern CSS, not only is this no longer the case, but we also have options on which way we want to center the item. In this video, I am going to show you one of the simplest ways to center an object inside of any container with just a few lines of CSS. Full Training Courses: IAmTimCorey.com
Using Outside Experience as a Software Developer
Переглядів 2 тис.14 днів тому
Can I use my experience from previous jobs as a software developer, or are those skills useless? How can I take advantage of my previous work experience outside of software development? These are the questions we will answer in today's episode of DevQuestions. Website: www.iamtimcorey.com/ Patreon: www.patreon.com/IAmTimCorey Ask Your Question: suggestions.iamtimcorey.com/ Sign Up to Get More G...
Separating AI Hype from AI Reality
Переглядів 9 тис.21 день тому
Is AI going to take developer jobs? Will AI replace junior developers? How do I tell when an AI product is real and when it is fake? Will AI become self-aware? These are the questions we will answer in today's episode of DevQuestions. Website: www.iamtimcorey.com/ Patreon: www.patreon.com/IAmTimCorey Ask Your Question: suggestions.iamtimcorey.com/ Sign Up to Get More Great Developer Content in ...
PUT, PATCH, and DELETE: : Building a Postman Clone Course
Переглядів 3,5 тис.28 днів тому
Last lesson, we added the ability for our system to properly process POST commands in addition to the existing ability to handle GET requests. In this lesson, we are going to add the rest of the common HTTP verbs, including PUT, PATCH, and DELETE. This will round out the functionality we have been working to get in place. Now this is lesson number 8 in our complete course on building a Postman ...
4 Other Careers Where Software Developers Can Excel
Переглядів 5 тис.Місяць тому
Are there other careers that a software developer could do well in? If I don't want to write code all day long, are there other jobs that might fit me? I'm considering a career switch. Where could I go? These are the questions we will answer in today's episode of DevQuestions. Website: www.iamtimcorey.com/ Patreon: www.patreon.com/IAmTimCorey Ask Your Question: suggestions.iamtimcorey.com/ Sign...
Wiring Up POST Commands: Building a Postman Clone Course
Переглядів 2,8 тис.Місяць тому
Last lesson, we updated the user interface to accomodate other types of commands. In this lesson, we are going to write the code necessary to get the POST commands to work. Included in this will be ensuring that we identify what code should be in the user interface and what code should be pushed into the library. Now this is lesson number 7 in our complete course on building a Postman clone. Th...
6 Myths About Software Development
Переглядів 4,5 тис.Місяць тому
Do I just write code as a software developer? What is the path to becoming a software developer? What is the right choice for programming language? These are the questions we will answer in today's episode of DevQuestions. Website: www.iamtimcorey.com/ Patreon: www.patreon.com/IAmTimCorey Ask Your Question: suggestions.iamtimcorey.com/ Sign Up to Get More Great Developer Content in Your Inbox: ...
UI Updates for HTTP Verbs: Building a Postman Clone Course
Переглядів 3,8 тис.Місяць тому
In this lesson, we are going to update our user interface to allow for other types of commands. Specifically, we are going to add the ability for a user to call a POST command to our API. This will include the ability to send data in the body of our command. Now this is lesson number 6 in our complete course on building a Postman clone. This course has been designed to be beginner-friendly and ...
The 5-Step Process to Improve at Anything
Переглядів 3,6 тис.Місяць тому
How do I get better at UI design? How do I improve my presentation skills? How do I grow my skills at working with a database? How do I get better at learning on my own? These are the questions we will answer in today's episode of Dev Questions. Website: www.iamtimcorey.com/ Ask Your Question: suggestions.iamtimcorey.com/
Portfolio Preparation: Building a Postman Clone Course
Переглядів 4,2 тис.Місяць тому
In this lesson, we are going to turn our project into a portfolio item. We are going to do this by upgrading our readme, adding screenshots and explanations, and by publishing a working version of our application. This will then be something we could show off to others and include in our portfolio. Full Training Courses: IAmTimCorey.com
5 Proactive Measures to Survive Job Uncertainty
Переглядів 3,6 тис.Місяць тому
How do I prepare to lose my job? If I think I might get laid off soon, how do I start preparing? Are there certain tasks I should be doing to get ready? These are the questions we will answer in today's episode of DevQuestions. Website: www.iamtimcorey.com/ Ask Your Question: suggestions.iamtimcorey.com/ Sign Up to Get More Great Developer Content in Your Inbox: signup.iamtimcorey.com/
Class Library Design: Building a Postman Clone Course
Переглядів 9 тис.Місяць тому
Class Library Design: Building a Postman Clone Course
5 Strategic Changes To Improve Your Career
Переглядів 3,8 тис.2 місяці тому
5 Strategic Changes To Improve Your Career
Creating the UI Design: Building a Postman Clone Course
Переглядів 9 тис.2 місяці тому
Creating the UI Design: Building a Postman Clone Course
3 Ways Every Developer Fails And How To Avoid Them
Переглядів 4,4 тис.2 місяці тому
3 Ways Every Developer Fails And How To Avoid Them
Fixing a Common WinForms Bug (CS0103) in 10 Minutes or Less
Переглядів 4,5 тис.2 місяці тому
Fixing a Common WinForms Bug (CS0103) in 10 Minutes or Less
Setting Up Our Project: Building a Postman Clone Course
Переглядів 9 тис.2 місяці тому
Setting Up Our Project: Building a Postman Clone Course
3 WinForms Setup Tasks You Should Do Right Away in 10 Minutes or Less
Переглядів 6 тис.2 місяці тому
3 WinForms Setup Tasks You Should Do Right Away in 10 Minutes or Less
9 Steps to Effectively Change Jobs For More Money in Software Development
Переглядів 4,8 тис.2 місяці тому
9 Steps to Effectively Change Jobs For More Money in Software Development
Create a GitHub Repo From Existing Code in Visual Studio in 10 Minutes or Less
Переглядів 4,4 тис.2 місяці тому
Create a GitHub Repo From Existing Code in Visual Studio in 10 Minutes or Less
Beginner-Friendly App Tutorial: Building a Postman Clone
Переглядів 11 тис.2 місяці тому
Beginner-Friendly App Tutorial: Building a Postman Clone
What Are Some Major Mistakes Developers Make in Their Career?
Переглядів 8 тис.2 місяці тому
What Are Some Major Mistakes Developers Make in Their Career?
How Do I Find the Best Developer to Hire?
Переглядів 3,6 тис.2 місяці тому
How Do I Find the Best Developer to Hire?
Global Error Handling in C# Minimal APIs
Переглядів 14 тис.3 місяці тому
Global Error Handling in C# Minimal APIs
How Do I Make My Portfolio Better?
Переглядів 3,9 тис.3 місяці тому
How Do I Make My Portfolio Better?
Containerize Your C# Application Easily with the .NET CLI
Переглядів 36 тис.3 місяці тому
Containerize Your C# Application Easily with the .NET CLI

КОМЕНТАРІ

  • @xx_shorbs
    @xx_shorbs 2 години тому

    I'm watching this video in 2024 and its so interesting to see all the formatting and workflow issues you noted during the publishing process are fixed exactly how you said they should be.

  • @arashsafi525
    @arashsafi525 3 години тому

    Thanks, your lessons are amazing

  • @dc03yo
    @dc03yo 7 годин тому

    Outstanding C# async/await presentation, Tim! This is the clearest, cleanest overview I've reviewed regarding this topic. I appreciate how each example shows a different approach while stating the benefits and costs of each. A simple view compares the performance of each approach.

  • @johanpacheco-eu8jd
    @johanpacheco-eu8jd 7 годин тому

    there are not Shared folder? where have to go the models? aaa

  • @ahmedmansoor1651
    @ahmedmansoor1651 8 годин тому

    Love it, thanks

  • @alexeybeloushko7240
    @alexeybeloushko7240 16 годин тому

    how do you get child form from a child form than?

    • @IAmTimCorey
      @IAmTimCorey 8 годин тому

      The same way you get the first child form. You specify what each form depends on in the constructor. When DI goes to satisfy the main form, it will see that it needs a child form. When it goes to provide the child form, it will see that the child form depends on a child form of its own. It will get the grandchild form first and work its way up the chain.

    • @alexeybeloushko7240
      @alexeybeloushko7240 7 годин тому

      @@IAmTimCorey and if creation require dynamic data?

    • @IAmTimCorey
      @IAmTimCorey 7 годин тому

      You would set up a factory in you DI system or pass in the data after creation of the generic class instance.

  • @saisupreeth5268
    @saisupreeth5268 17 годин тому

    Wonderful explanation!!

  • @narutex216bits8
    @narutex216bits8 20 годин тому

    The reason for microsoft change soo much the sintax is to force you to use new windows. I doing technical school and the school have a partnership program with microsoft. So we have C# in our curriculum. I have an old computer but decent, has six core 3.2 and 16gb of ram. But in school we use .net 8 and it don't run on my computer, because it's on the limit, i can't use a newer windows to use the .net 8. They made this to force us to buy a new computer and keep use the new buggy version of windows. Before you ask me to buy a new pc or a mac, i live in Brazil, so our currency is 5 by 1 in comparison to dollar purchase a pc is a real pain in the a**. you have to import from aliexpress and pray the parts to arrive and goverment not tax. Or buy a PC here and pay a price of a kidney . We have this 2 simple choices here. I not even tell you when the time the RTX 2080 ti came out is 999 in your country, but here is sold for 6000 dollars, almost a price of a popular car or a small house.

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      This is a rather bad misconception. The issue is not C#/.NET. The issue is that Visual Studio does so much, but it requires so much power. For instance, I have a Raspberry Pi keyboard Computer (full computer in a compact keyboard). It barely runs anything because it has a 1.8 GHz processor and 4GB of RAM. I have it running VS Code with the C# plug-in. I've built and run full Blazor apps on that computer. So no, you don't need a massive computer to build and run .NET applications. Yes, Visual Studio does take up a lot of space and a lot of power, but that's because it is a full IDE running AI tools and has all of the Intellisense/Intellicode/etc. features that are constantly running to make you as efficient as possible as a developer. If you need to develop .NET projects, but are struggling to get a computer that runs Visual Studio well, check out VS Code and the C# Dev Kit. You can use even really old hardware running a free version of Linux and get a lot of power out of it.

  • @ChrisWard74
    @ChrisWard74 22 години тому

    So I'm not sure what the ".AddUserSecrets" is really getting you since you could add another .AddJsonFile that was called usersecrets.json and that could be in your project but then add that file to .gitignore. What am I missing? Also say you give your app to someone how would they create a usersecrets.json file that the app would use. Additionally for development purposes what I like to do is have a second appsettings just for dev and add it after the main appsettings.json and it used the Environmentname so you have a appsettings.Development.json file and Visual Studio will put it as a branch under your appsettings.json file but make sure it's marked optional because you don't want an error when you deploy your console app. config .SetBasePath(ApplicationPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{hostContext.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true);

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      The purpose of user secrets is to ensure that secrets don't accidentally get out. Adding a file to your project, ensuring it is in the gitignore, and making sure no one accidentally uploads it is a lot harder than just using the existing system that just works. As for sharing those secrets, you don't. That's the point. They are just for you on your machine. Even a different machine will probably have different secrets. Typically, you use user secrets for storing your local SQL database, etc. When another user wants to spin up a development machine, they either use the defaults from appsettings.json or they create their own secrets file. That's why I create the blank entries in appsettings.json. That way you know what settings need to be added to secrets.

  • @OldGuyAdventure
    @OldGuyAdventure 23 години тому

    Been working on a rework for machine event software and have been planning how to move it to C# as a service. It has settings that it needs to use to verify certain conditions exist with specific machines and valves.

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      If you are looking to create a service, check out the Worker Service project type. It runs as a Console app for testing but then installs as a service (or daemon on Mac/Linux). It has appsettings, dependency injection, and more built-in.

  • @higherpurpose1212
    @higherpurpose1212 День тому

    Thank you Tim, as always, a valuable tool to know. Just hoping you could make a video for learning the very essentials of .net ecosystem, what to learn and what to look for, how to use them properly. cheers!

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @gokhanserkan5616
    @gokhanserkan5616 День тому

    learn english before c# :D thanks

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      Not strictly necessary, but it is really helpful.

  • @sirrexos1596
    @sirrexos1596 День тому

    I wish this video was released last week 😂

  • @MrFlakgorilla
    @MrFlakgorilla День тому

    I got first into C# as my first job in the software development world from building frontend projects with react and vanilla TS/html/css. It was a job that would entail creating injectable dll files for an enterprise software to import and use. While I delivered what was required and I enjoyed learning C# while commuting 2h everyday on the train, the ceo and me realized we were mismatched on what we wanted from each other. For me it was finding a door into the world of development and hopefully have the time to self study CS with all these almost complete curriculums. He wanted some kind of butterfly that also knew how to automate away two soon to retire coworkers jobs. For now I am focusing on the joy of creating web applications and just make simple web apps with angular as the frontend and c# in the backend while going through the retraining to become a sysadmin and for now a good helpdesk guy. I can't wait to finish my project and deploy it, but I also realize I need to refresh some steps that have become just vague and not as confident in explaining definitions and the idea of what makes .net great and the best programming language I have tried so far. Can't wait for my 2 weeks vacation to progress better on my hobby/job skill.

  • @liber_channel
    @liber_channel День тому

    What we need to deploy the app? Where those json files will be created/copied? Great video but this is not clear

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      If you deploy the app, you would deploy the appsettings.json file with the app. That's why we said it needed to be copied if newer. That copies it to the output directory. Secrets is just for your machine. When your app is deployed, you would either update the appsettings.json of the built file with the secrets it needs or you would update the environment variables if you deployed your app to a cloud service.

    • @liber_channel
      @liber_channel 16 годин тому

      @@IAmTimCorey thanks. But the "secrets" file?

    • @IAmTimCorey
      @IAmTimCorey 7 годин тому

      That’s just for your machine. It is information that you use for local testing. In production you don’t need it because appsettings works just fine.

  • @AldoInza
    @AldoInza День тому

    I was literally looking into this last week. Another bookmark.

  • @W4L3YT
    @W4L3YT День тому

    Is it just me or is Microsoft constantly trying to reinvent the wheel?

    • @ByronScottJones
      @ByronScottJones День тому

      Could you elaborate on what you mean?

    • @IAmTimCorey
      @IAmTimCorey День тому

      I'm not sure what you mean. Do you mean because there is a "new" way of accessing settings compared to what they used with the .NET Framework? If so then yes, like all developers, they are looking to improve on what they have done in the past. Instead of utilizing the slow, clunky system they had, they upgraded to an incredibly powerful new system that is flexible and much, much faster.

    • @W4L3YT
      @W4L3YT День тому

      @@ByronScottJones There are too many ways to create and access configuration files. I am not complaining about it. But there seems to be a "hey, let's come up with a new way to do that" mentality going on. There are App.config (or Web.config) and Settings.settings. Now there are launchSettings.json and appsetings.json.

    • @W4L3YT
      @W4L3YT День тому

      ​@@IAmTimCorey Yes, that is what I mean. If this new way of accessing the settings files is faster than previous iterations, then I am OK with it. However, upon initial usage, it seemed unnecessary and convoluted. I like to keep things simple. :)

    • @IAmTimCorey
      @IAmTimCorey День тому

      It is definitely faster. It is also MUCH more flexible. The old system required app.config/web.config and it did not handle overrides very well (thus tools like Slow Cheetah). This system is modular, meaning you can bring in five different sources "out of the box" by default in ASP.NET Core (appsettings, developer/release settings, secrets, environment variables, and command line arguments). However, you can choose to add more or remove some. In this demo, we built out our own config builder and only added the ones we wanted. We could have also added additional ones like Azure KeyVault very easily. In this system, the control is all in the hands of the developer rather than Microsoft forcing you to use one system in one way.

  • @djupstaten2328
    @djupstaten2328 День тому

    My head fills with Judas Priest whenever a workflow-dogma acronym is foisted upon me. They tend to be wildly unsuited for almost anything when applied rigorously.

    • @IAmTimCorey
      @IAmTimCorey День тому

      All rules have exceptions and best practices don't even rise to the level of rules. Developers need to be discerning about what they do and why they do it.

  • @cuachristine
    @cuachristine День тому

    Tim, Directory.GetCurrentDirectory() doesn't work if you start the console app from another dir like apps\myapp\myapp.exe. Instead you have to get the path of the exe (e.g. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName) and manually set the directory via Directory.SetCurrentDirectory. Cheers

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      I'm not sure what you mean "start the console app from another directory". I've not had a problem with GetCurrentDirectory. Are you saying that when you run the exe, it doesn't detect where the exe is?

    • @cuachristine
      @cuachristine 17 годин тому

      @@IAmTimCorey So for example, let's say your app is in c:\myapps\mycookingapp\cooking.exe. And then you cd into the root c:\, and run "myapps\mycookingapp\cooking.exe" from the command line. In this case GetCurrentDirectory will return "c:\". Or another example, you put your app's directory into the PATH and execute from any random directory. GetCurrentDirectory will return whatever directory you are currently in.

    • @IAmTimCorey
      @IAmTimCorey 7 годин тому

      Ah, I see. Thanks for sharing!

  • @alexlo5655
    @alexlo5655 День тому

    Hi Tim, Thank you for the Video. You didn't mentioned in your video what will happen when the code will be pushed to PROD. How the secretes will be accessed? from Production.apsettings.json, which is revealing the secrets? Should this be elaborated? I believe the code which reads from some "secret" vault should be added.

    • @VuongoanPro
      @VuongoanPro День тому

      the same question, I'm also very curious about this

    • @donaldlee6760
      @donaldlee6760 День тому

      Another same question, specifically if hosted in a Google Cloud Windows VM as is pretty common. I assume the answer is most often a Windows environment variable because the Windows server admins are typically OK to know the secret. If the server admins are not authorized to see the secret then I'm at a loss of what options to consider. I really don't want to overcomplicate the solution by adding an Azure keyvault because organizations that use Google cloud are unlikely to also use Azure.

    • @alexlo5655
      @alexlo5655 День тому

      @@donaldlee6760 My personal opinion - you have to have a service which reads the secret key. And depends on environment and settings you have to register it in DI and it will produce you the key either from the secrets location in you PC or from Azure or from Google Cloud, etc.. My personal opinion that this should be presented in this video.

    • @IAmTimCorey
      @IAmTimCorey День тому

      I talked about this briefly in the video. If, for instance, you deploy to Azure, you would use the Environment Variables in Azure to store your secret information. Other cloud providers typically have something similar. If, however, you are deploying to a full server (not a hosted web app or serverless solution), you would put your secrets right in the appsettings.json when you publish to the server. Not in source control, but when the CI/CD process publishes your application to the server, it would update the produced appsettings.json file with the secret information. This is because you should trust the server you deploy to and it should have restricted access. If it does not, your information is not secure. It does not matter if you use environment variables, secret keys, encrypted values, etc. If a user has control over the machine that is running the executable, they can see your information in clear text no matter what you do. This answers @donaldlee6760's question as well - if you don't trust the server admins, they should not be server admins. If they are an admin, they have access to see your secrets. All of them. The secrets.json file is only for local development. Its purpose is to keep secrets out of source control. That is it. There is no equivalent for the deployed location. You use appsettings.json to store your secret information once it gets to the server (again, by updating it via CI/CD) or you put that information in environment variables if you deploy to a cloud provider.

    • @alexlo5655
      @alexlo5655 День тому

      @@IAmTimCorey Thank you very much for the clarification and explanation.

  • @PGWalkthrough
    @PGWalkthrough День тому

    great video, i just have a question, when you working in a team and each developer use the secret file, does this mean that each developer secret file guid will be added to the project? how to maintain those guids? lets say you have 10 developers and maybe some people left the company, do you have to delete the guids for the developers that left from project file?

    • @IAmTimCorey
      @IAmTimCorey День тому

      Once the GUID is set, everyone uses that same GUID. Since the likelihood of it already being in use is infinitesimally small, it isn’t a problem.

    • @PGWalkthrough
      @PGWalkthrough День тому

      @@IAmTimCorey Thanks for the quick reply. I think we did that eventually. just note every time a new developer press on manage user secrets it creates a new user secret file for them. so we had to manually update the user secret file name to be the same as the existing guid then remove the reference to the new guid from the project file.

  • @serpent77
    @serpent77 День тому

    I'm not a developer, but I do like to code small utilities, powershell cmdlets, etc. It seems that c# + .net framework was so much more approachable than newer .net. it took me a week to understand how to get things done back in .net 2. It wasn't "correct", but it worked. New .net versions seem to want to force you into "correct" development, even if you don't need to. I.e. create a builder to get access to app settings, in .net framework it was basically just a using statement and then use it.

    • @IAmTimCorey
      @IAmTimCorey День тому

      The reason you could do that in the .NET Framework was because it included everything in the framework. That was terribly expensive and wasted a lot of space. Yes, it is a bit more complex to add a NuGet package, but it also makes our applications more efficient.

    • @serpent77
      @serpent77 День тому

      @IAmTimCorey I did hear you say that in the video, but again, that goes to my point. I'm not developing cross platform, for-profit, multi-developer solutions. I'm creating a powershell cmdlet that needs to run on a windows server for a set of tasks required for an I external application. By forcing me into a methodology that is intended to allow for portability, multi-platform, multi-developer solutions, it just keeps me from creating the tools I need. Nuget is fine when you need to extend the library, but if all you need is the stuff built in to the OS via framework and/or powershell, it'd be nice to have an option to skip out on SOLID where it makes sense. If I don't need DI then why must I go through the process of configuring builders and what-not? I have code that does simple things like converting XML to a Cisco switch config. It's mostly repetitive, and a PITA to script, but using c# and .net framework the code is fairly trivial. And I haven't changed it in 10 years. Forcing me to make it maintainable, portable, git friendly, for multiple developers, etc. Would make it pointless to create this utility that helped me generate hundreds of configurations for cloud servers and switches in minutes, compared to the weeks it took to do manually. It speaks to my belief that there are developers, and there are coders. Developers have a mandate to do everything right so others can come in behind them and embrace and extend the code. Coders have a simple problem that needs a simple solution. Doing it "right" is counter productive. It's the very notion of "don't let great be the enemy of good enough" I appreciate your response Tim. This isn't the first time we've had this convo in the Comments, I'm just wishing that MS might skim them and see they're ignoring a valid set of needs faced in the community to attempt to compete with Java, rust, etc.

    • @IAmTimCorey
      @IAmTimCorey День тому

      I'm not sure what Microsoft is going to take away from that suggestion. It sounds like you are arguing with yourself. On one hand, you want things baked into the framework rather than using NuGet packages but on the other, you don't want to be forced to use SOLID, etc. so you want flexibility. These NuGet packages ARE a part of the framework. They are just optional pieces. Think of it like installing Visual Studio. Instead of it just installing, it allows you to choose which packages you want. Yes, that is more complex up front, but it allows you to install just what you need instead of tools that you don't need. You could have a 12GB installation instead of a 30GB installation. The same is true for .NET Core. There are NuGet packages that are optional parts of the framework. You just need to choose which ones you want. As for being forced to do DI, that's not what we were doing. The builder, in this case, was just loading the configuration files we requested (appsettings and secrets.json). That's it. This also has nothing to do with cross-platform. This is just about being a modular framework that doesn't force every project to have an appsettings.json in a certain place (unlike .NET Framework, which required an app.config/web.config in the specific place and was not flexible). If you don't want to use the configuration system, you also don't have to. You could create a CSV file that goes with your app that has key/value pairs and you could very easily load it instead of loading settings. That would work and it would work just fine. You could also hard-code the values in your app if that is all you needed. Put them at the top in constants and call it good. This system allows for more flexibility for you to choose how you want to do it, from ultra-simple and not multi-user/git friendly all the way through enterprise-level secure and optimized. You as the developer get to choose what you want to do.

  • @MarcioZbs
    @MarcioZbs День тому

    I use to start with a worker service template and remove the background service stuff.

  • @jesusdelarua5995
    @jesusdelarua5995 День тому

    As always, Great course! Thank you Tim! I cannot access source code :( Error. An error occurred while processing your request. Request ID: 40002868-0000-c400-b63f-84710c7967bb

    • @IAmTimCorey
      @IAmTimCorey День тому

      Thanks! I'm working on the source code download system. I'm tracking down a bug related to rotating the password.

    • @jesusdelarua5995
      @jesusdelarua5995 День тому

      @@IAmTimCorey Thank you Tim!

  • @D0ct0rD4RK
    @D0ct0rD4RK День тому

    SlowCheetah is a great NuGet for this.

    • @IAmTimCorey
      @IAmTimCorey День тому

      I haven't used it in years since I don't do many .NET Framework projects anymore. Is there a reason to use it in .NET Core (which includes .NET 8)? Since the transformations are built-in, I haven't found a need. I was wondering if you had one I missed.

  • @johnkiddjr01
    @johnkiddjr01 День тому

    Great info, as always! One thing to look at though, is when setting the "SetBasePath" you used "Directory.GetCurrentDirectory" which will not always give you the directory your executable is in (particularly on Linux when the application is started by a different application) which will cause it to not load the appsettings.json file. Using "AppDomain.CurrentDomain.BaseDirectory" seems to always use the folder the application is stored in, giving more consistent behavior.

  • @michi1106
    @michi1106 День тому

    rly love your videos. In addition to this content. I start to use these settings to store my configuration, but there is a big issue that you may sshow/say to others as well. It's readonly. So for my WinForms- Practice-Program, not so useful. But i found a very useful hint on stackoverflow. Just as you show before, it's possible to add mutliple-files to the configuration during the build. So i just add a second "appsettings.json"-file to the configuration, like this "configuration.AddJsonFile(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ProductName, "appsettings.json"), optional: true, reloadOnChange: true);" Then i designed a settings-class for serilisation. Stored the changed values there and save the file at the end. And with a new start, the configuration-builder merged the 2 settings-files and i can use the normal configuraion-handling. So maybe someone else, find this helpful.

  • @demariners
    @demariners День тому

    Is there a way to "Alter" the settings as well as read them in code?

    • @jamesbest3347
      @jamesbest3347 День тому

      Yes, I believe you can index your value and then set it something like configuration["MyValue"] = "Test";

  • @demariners
    @demariners День тому

    As always, super useful! Thank you for what you do! I have been looking and I am not sure if you have done this already, but please consider doing a video on Source Control. Specifically within VS and explaining how to do the more advanced stuff such as cherry picking, rebasing, and stashing. It has always been so confusing for me within VS.

    • @IAmTimCorey
      @IAmTimCorey День тому

      Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @faisalalhoqani6151
    @faisalalhoqani6151 День тому

    Great episode dear Tim, thank you and keep it up.

  • @alexlo5655
    @alexlo5655 День тому

    Source code link is broken.

    • @IAmTimCorey
      @IAmTimCorey День тому

      I'm working on the source code download system. I'm tracking down a bug related to rotating the password.

  • @valhallagalex
    @valhallagalex День тому

    What happened to the postman clone series? I believe there hasn’t been an update in a long while.

    • @iasonmax3473
      @iasonmax3473 День тому

      It is over

    • @IAmTimCorey
      @IAmTimCorey День тому

      At the end of the last video, I let you know it was the last video and what I recommended you do next.

    • @valhallagalex
      @valhallagalex День тому

      @@IAmTimCorey my mistake. I was waiting for it to be done before I started. Your series were longer in the past. Appreciate your work regardless

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      Ah, gotcha. Yeah, this one was a short one. I may add to it in the future. We will see. For now, it is concluded though.

  • @Cornelis1983
    @Cornelis1983 День тому

    I was against breaking the rules until I realized I am breaking rules too. For instance, in my own project, all my Web API 2.0 endpoints are POSTs. Why? Because it makes my life easier. I dont have to think about when an endpoint should be post or put. But, one problem with deciding when to break which rule while working in a team is the stubbornness of a developer. Developers always think they are right so when 2 developers have a different opinion in when breaking a rule or not, it will create a difficult time on the job. 😂

    • @IAmTimCorey
      @IAmTimCorey 18 годин тому

      That's part of being a developer - figuring out how to agree upon standards.

  • @ememeable
    @ememeable День тому

    Ahh you Go-d Whats Up I thank you Sincerely Ejike

  • @wildrice1971
    @wildrice1971 День тому

    Thanks for this overview, Tim ... very helpful!

  • @kaleempeeroo7252
    @kaleempeeroo7252 День тому

    Great real world scenario and practical series! Thanks

  • @nwdreamer
    @nwdreamer День тому

    But will AI ever be more powerful than RS??? 🤔😁 I work with a guy who's addicted to AI (it can be painful!). The issue is this: Put 100 random people into a room. How many are experts in any single topic? VERY doubtful that it will be all 100! However, AI is trained on all the information out there which also includes a large amount of sub-standard stuff! When I do ask it for something, its success rate is about 10%, however, to be fair, it does give me ideas so I can figure things out myself.

  • @The-one-and-only-Fruitcake
    @The-one-and-only-Fruitcake 2 дні тому

    24:52 how did you collapse the column and row definitions?

    • @IAmTimCorey
      @IAmTimCorey 2 дні тому

      There is a little plus/minus icon to the left, just to the right of the line numbers. Click that to expand/contract the section that it controls.

  • @chemouriabdo406
    @chemouriabdo406 3 дні тому

    what about migration in asp web api ? wen i create the docker image the migration doesn't work in my own remote server

    • @IAmTimCorey
      @IAmTimCorey 2 дні тому

      You have to make sure that the container has the correct access to your SQL Server in order for it to run migrations.

  • @ahmaddawood9691
    @ahmaddawood9691 3 дні тому

    Hi Tim .. you already answered the question clearly when u said : c# should not do SQL job ...also a sentence u said in your sit about dapper : It is beginner-friendly... does this means dapper is only for beginners and not suitable for large apps ? .. thanks

    • @IAmTimCorey
      @IAmTimCorey 2 дні тому

      Nope, Dapper is absolutely a tool for everyone. It is incredibly performant and has been proven in high-throughput situations. In fact, larger apps will more often benefit from Dapper over EF because of the performance gains.

  • @willembeltman
    @willembeltman 3 дні тому

    You totally had me until you started using dependency injection in the handler.

  • @abdoulaye560
    @abdoulaye560 3 дні тому

    Thank you Tim

  • @andergarcia1115
    @andergarcia1115 3 дні тому

    Thank you, Master! That's a topic that sparks a lot of debate. Your clarification really helped me understand the 'why' behind it.

  • @andergarcia1115
    @andergarcia1115 3 дні тому

    Wow, Master, this is fantastic! I love it! Thanks

  • @tonyfearn5350
    @tonyfearn5350 3 дні тому

    Hi Tim, firstly thanks for all your tutorials, you are in my opinion the best teacher of code on the net. I wanted to put something to you. I have recently start a new role with a new company and been put onto a product/site with another colleage. I noticed an error when familiarizing myself with the code. This particular error came from a ChangePassword method and the error explained it was a transaction error. Now i have never seen transactions in C# before but proptly done a bit of resear h and fixed it. The problem i have it that in this single method there were 16 lines concerning transactions, which made the code messy and difficult to read and looking around i noticed most methods are built this way. Out of curiousity i commented out all the transactions code and ran it, and it worked fine, so i guess what im asking is for your advice. I wondered what your thoughts are using transactions in C# when our stored procedures can contain them! Is it also good practice to use transactions in C#. Many thanks

    • @IAmTimCorey
      @IAmTimCorey 2 дні тому

      I don't love transactions in C# because it includes a network hop inside of the transaction. That can be messy and can lead to open transactions if you aren't careful. I prefer to do transactions on the SQL side. However, sometimes that doesn't work. For instance, in the TimCo Retail Manager course here on UA-cam, I use a C# transaction out of necessity. When using a transaction, you should make sure it is necessary. For instance, if you are only calling one stored procedure then a transaction is not necessary in C#. Instead, if you are doing multiple tasks inside of the stored procedure, you can put the transaction inside of the stored procedure. It would only be if you cannot change the stored procedure that you even consider using a C# transaction. Even then, I would recommend a new stored procedure instead. Taking the transaction code away in C# won't really show you anything. That code only executes if the transaction fails, so unless you are testing that part of it, everything should work. Be careful to fully understand the why before taking out working code.

  • @simonverwaltungsrat5445
    @simonverwaltungsrat5445 3 дні тому

    Love you <3

  • @woudjee2
    @woudjee2 3 дні тому

    When I follow your steps, my nuget version contains the git commit hash. I have been searching for about 3 hours now and I cannot find any information anywhere on how to remove the commit hash from the version. Do you know what I can do about it? So my version is: 1.0.2+fb22cefd836ec0cb3e1310f12cfc4a4d4a92b593 instead of 1.0.2.

    • @woudjee2
      @woudjee2 3 дні тому

      Oh one slight difference between your setup and mine (I believe so at least) is that I am using the SDK style project setup. The reason I believe you don't is because you posted this video 4 years ago and you did not get the notification I did saying that 'pack' was not possible on SDK style projects.

  • @theflightcombatant7804
    @theflightcombatant7804 3 дні тому

    hey tim bro , how can we store dates and time etc

    • @IAmTimCorey
      @IAmTimCorey 2 дні тому

      There are options, but the easiest one in my opinion is to use a text field. You could use an integer and calculate seconds from 1970 among other options, but those options aren't human-readable when scanning database columns. I prefer just using text and converting it back to DateTime.

    • @theflightcombatant7804
      @theflightcombatant7804 День тому

      @@IAmTimCorey So If We Have A DateTimePicker named as DTP this means we can define string theDate = DTP.Value.ToString("yyyy-MM-dd") OR Something Like This and Then We Should Store THis String onto the DB

  • @TolchinJ
    @TolchinJ 4 дні тому

    How do you have a named client and also use a certificate? Without a factory, I would just create a HttpClientHandler and add the client certificate. Then add the handler to the client on creation. Additionally, how would you reset this client to a new certificate without restarting the app?

  • @X3D553
    @X3D553 4 дні тому

    Накидал говнокода в один файл и норм, работает же! Зачем эти абстракции, наследование и прочая хрень? Только время тратить. Главное, чтобы работало, а то, что там потом хрен разберешься, это уже проблемы будующего меня.

    • @IAmTimCorey
      @IAmTimCorey 4 дні тому

      There is always going to be a careful balance to maintain, which is what I talked about in this video.