Reading appsettings.json from .net standard library

i have started a new RESTful project using .NET Core Framework. I divided my solution in two parts: Framework (set of .NET standard libraries) and Web (RESTful project). With Framework folder i prov...

Multiple Dtos for same entity

Is it a good practice to use multiple DTO's for same entity in different API endpoints. For example: I have a api endpoint which accpets the following Dto: ``` public class AddressDto { public st...

18 Nov at 14:19

How to run dotnet core app from command line?

I created a CLI tool using dotnet core framwork and I want to run it form the console as: I run it now by going to the location where the dll file is by uing: Can anyone help me install my application...

28 Aug at 09:19

How to connect to a MySQL Database without SSL

I'm trying to connect to a local MySQL DB. I have this connector: ``` using(MySqlConnection conn = new MySqlConnection("Database=Studentenverwaltung;Port=3306;Data Source=127.0.0.1;User Id=root;Pas...

23 Jan at 10:36

OpenIdConnectProtocolValidationContext.Nonce was null

HI can someone please help imgetting below error when calling outlook rest api IDX21323: RequireNonce is '[PII is hidden by default. Set the 'ShowPII' flag in IdentityModelEventSource.cs to true to r...

25 May at 21:41

Programmatically turn on/off Action Center

Is there a way to programmatically turn on/off the Action Center? Additionally, I'd like to know if there is a way to programmatically turn on/off specific notifications? In manufacturing we use a b...

25 May at 14:23

Aggregate $lookup with C#

I have the following MongoDb query working: ``` db.Entity.aggregate( [ { "$match":{"Id": "12345"} }, { "$lookup": { "from": "OtherC...

EF Core Migrations with multiple DbContexts on single database

I have an issue attempting to use Migrations in a ASP.NET Core solution using EF Core where there are multiple `DbContext` that share the same SQL database. In my application startup method I'm getti...

How to mock rows in a Excel VSTO plugin?

I am trying to put a mocked `Range` (which contains cells with values) inside the rows of a new `Range`. But when I try to access a specific element from the `Range`, a exception is thrown. I've trie...

1 Jun at 22:12

Issue Moq'ing HttpResponseMessage

I have the following Method: ``` public async Task<SecurityRoleDeleteResult> DeleteSecurityRoleByRoleId(int securityRoleId) { string url = $"{_housingDataSecurityConfiguration.HousingDataSecurity...

25 May at 09:45

How to register two implementations then get one in .Net Core dependency injection

I have parts of my code which depend on more than one implementation of the same interface, and other parts which depend on one of the implementations. I am registering implementations like: ``` ser...

29 May at 10:14

Error:An unknown error occurred while invoking the service metadata component. Failed to generate service reference

When trying to use .net core 2.1 rc1 to add a service reference for WCF, I am experiencing the following error: ``` Error:An unknown error occurred while invoking the service metadata component. Fai...

24 May at 12:21

UWP VisualTreeHelper.GetParent() returns null

I have a `ContentDialog` which has a `ListView`. This `ListView's` DataTemplate Contains a `Grid` and this `Grid` has a `Button`. The code goes like this: ``` <ContentDialog x:Name="DownloadListDialo...

28 May at 16:46

Updating .NET framework resulting in SQL timeouts

We have an app which targets .NET 4.5.1, and this has remained unchanged. However when we upgraded the .NET framework on the server from 4.5.1 -> 4.7.1, we started experiencing SQL timeouts several h...

29 May at 08:47

Authentication in WebApi with AllowAnonymous attribute

I have implemented a JWT-based authentication by inheriting `DelegatingHandler` and adding the class as `configuration.MessageHandlers.Add(new MyDelegatingHandler())`. When implementing `DelegatingHan...

22 May at 04:20

Cannot create commands from unopened database

I've searched around quite a lot and I cannot find any answers to this. I am writing a Xamarin Forms Mobile application, it seems when I minimise the application and then reopen it or one of my activ...

How to set NLog max file size?

Is there any option/configuration in `NLog` to set the max log file size (for example 5MB)? What I need is, that when the log file exceeds the max size (which I define), It will backup the old one (w...

24 May at 05:42

C# Clearing list before nulling

Today I have seen a piece of code that first seemed odd to me at first glance and made me reconsider. Here is a shortened version of the code: ``` if(list != null){ list.Clear(); list = null;...

24 May at 03:46

Caching an HttpResult/memorystream using newer CacheControl attribute

I just discovered the new CacheControl Attribute and it's working well for standard POCOs - I was wondering if something different was required to cache a service that returned an HttpResult as a PDF....

23 May at 18:20

WinForms TreeView checking/unchecking hierarchy

The following code is intended to recursively check or un-check parent or child nodes as required. [](https://i.stack.imgur.com/EZ1wZ.png) For instance, at this position, , , , and nodes must be un...

14 Dec at 16:40

How can I use SQL Server JSON_VALUE function in EF 6 Code First for classic .NET

How can I use SQL Server JSON_VALUE function in EF 6 Code First for classic .NET? I found I can do it in like this: ``` public static class JsonExtensions { public static string JsonValue(string...

Why can't a C# struct method return a reference to a field, but a non-member method can?

Here's an example of an instance method of struct attempting to return a readonly ref to an instance field of the struct: ``` struct Foo { internal int _x; public ref readonly int MemberGetX...

23 May at 14:43

ServiceStack AutoQuery join use

After reading the documentation, I am not sure but I have come to the conclusion that when creating QueryDb, you cannot choose the columns to join by? And I am under the impression, you must have DTO ...

AuthorizeRequestValidator: Error: Invalid grant type for client: implicit

I am trying to setting up Identity Server 4 `HybridAndClientCredentials` on .NET Core 2.0 MVC. I'm struggling with the error: > Invalid grant type for client: implicit Even though I have in my code...

Entity Framework Core: Fail to update Entity with nested value objects

I have an entity that has a value object and this value object has another value object. My issue is that when updating the entity along with the value objects, the entity with the parent value object...