EF Core: IEnumerable to separated list of string

C#, SQL Server
The problem In my database I have a column where I store comma separated strings representing a combination of options/features I need to use on the website. It would be nice to be able to access the comma separated items as an IEnumerable so I can use it to - for instance - populate a dropdown list. Some thoughts Of course, I could use entity framework core to get the string value from the database, and then split that string into a list, and use that in my page model. However then I don't know how many times I would need to do that in the future, when I might be building more and more functionality based on this same column. Also, I cannot think of a situation where my…
Read More

Using Dependency Injection and IOptions in Azure Functions

Azure, Backend Development, C#, Development
So, I created this Azure Function and because I have a lot of parameters that I would like to be able to use in dependency injection I did not want to go with the familiar way like this: var firstName = Environment.GetEnvironmentVariable("FirstName"); Instead I want to use the Options pattern as I would do when creating a "normal" appsettings file. However, Azure Function configurations only feature key-value pairs for configuration and do not support JSON configuration files. Luckily there is a way around this using a little peculiar syntax. Writing the code First, we create our options class: public class ParentOptions { public string FirstName { get; set; } public string LastName { get; set; } public ChildOptions ChildOptions { get; set; } } public class ChildOptions { public string…
Read More