Programming
Check if a Value is Present in Multiple Lists
If you have 2 (or more) lists in C# and you want to check if they have 1 or more values in common then you can use the following LINQ to check.
If you have 2 (or more) lists in C# and you want to check if they have 1 or more values in common then you can use the following LINQ to check.
If you have 2 dictionaries of the same datatype in C# which you want to merge together then you can use the following code. If a key exists in both of the dictionaries then the primary value will overwite the Read more…
If you have a complex table structure in SQL that you want to map into corresponding classes in your .NET Core project it might be easier to output the result of your SQL query as JSON and then deserialize the Read more…
I’ve been trying to figure out the best way to provide access to connections in my services via Dependency Injection (DI) for a while now. Typically I’ll pass the IConfiguration object through to the service using DI and then retrieve Read more…
If you want to get a users username in a site that uses authentication then you can just use the User object and that will provide all claims associated with that user. However if you want to get the username Read more…
I’ve used Azure Active Directory (AAD) authentication and authorization in a variety of Web Apps for logins, calling external APIs (e.g. Graph API) and authorizing site area access and while authentication is reasonably simple to get working authorization has always Read more…
OData is an open protocol for enabling interaction with a datasource in a standardised way via a RESTful API. Theoretically using OData in combination with Entity Framweork should provide a simple way of providing access to SQL (or other) data Read more…
Bootstrap Table is the best way I’ve found of adding additional functionality to HTML tables. One of the nice features about it is that it will load data from a URL if it’s provided in the correct JSON format which Read more…
I’ve been working with OData recently and one thing that briefly stumped me was that the property names begin with @ and in an MVC view the @ symbol is used to indicate C# code so when I tried to Read more…
If you want to use Entity Framework to access pre-existing SQL tables (the database first approach) then providing they’re all keyed up correctly it’s possible to generate all the required classes and the DB context for them with just a Read more…