Get Values from AppSettings.Json (.NET5 / .NET Core)

Get Values from AppSettings.Json (.NET5 / .NET Core)

Data Vids

3 года назад

9,895 Просмотров

Get Values from AppSettings.Json into your controllers. This video shows how to do this in a MVC app using .NET5 but it would work in any core or dotnet5 web application resulting in strongly typed serialized class data for you. You also get a glimpse into more simple dependency injection classes provided by our good friends at Microsoft.

Тэги:

#appsettings.json #.net5 #dotnet5 #dotnet_core #.net_core #serializing_appsettings.json #asp.net_mvc_dotnet5 #asp.net_mvc_core #asp.net_mvc_appsettings #reading_config_values #extract_data_from_config #project_properties #c# #csharp
Ссылки и html тэги не поддерживаются


Комментарии:

@kathijaparveen3609
@kathijaparveen3609 - 05.05.2022 05:23

Is it possible to inject in model class instand of controller

Ответить
@KenKraska
@KenKraska - 02.05.2022 01:22

Perfect tutorial without the fluff. Many thanks

Ответить
@attilaguba856
@attilaguba856 - 04.03.2022 04:17

Great short tutorial, exactly that's what I have been looking for! Thanks!

Ответить
@pw.70
@pw.70 - 07.02.2022 18:45

Very succinct and well made - thanks for the video.

Ответить
@DiegoLanda91
@DiegoLanda91 - 28.10.2021 22:30

If I use this configuration for my website and there I have a lot of differents configurations like timeouts, some boolean configs that interects with html & js and wathever, is there a problem if more of one person use it for its personal configuration? I mean, by example, George sets its timeout to 20000 ms. and save it in appSettings.json and then Anna from its personal account set it to 50000 ms. and save it... Will George have the Anna's configuration? Contemplating that the MVC application lives on the same server.

Ответить
@ggariepy
@ggariepy - 17.09.2021 19:45

This was a nice introduction to using the appsettings.json data within a controller. In my case, the controller was part of a WebAPI project, and after I suspended disbelief and just did what you said, it worked. Dependency Injection is still a new concept for me. Appreciate the help!

Ответить
@rafepta
@rafepta - 22.06.2021 11:49

Thank You

Ответить
@xfec6112
@xfec6112 - 26.05.2021 01:46

Un grand merci à toi !

Ответить