AutoMapper 5.2 how to configure

What is the correct way to configure AutoMapper for global use. I want to set it once and then used though out the app. i have a strong feeling this is wrong. in fact i know this is wrong as this ca...

28 Feb at 12:30

Update specific field in mongodb document

I using C# driver to use MongoDb in small projects, and now I stuck with updating documents. trying to figure out how to update the field (int) here is my code: ``` IMongoCollection<Student> studen...

28 Feb at 11:32

Where do the parameters for KeyVaultClient.AuthenticationCallback Delegate come from?

I'm trying to call all the vaults in a subscription. The approach I'm using is this - Controller Helper For my controller "test.Token" always returns null but I can't help but think it may be from me ...

How to return custom message if Authorize fails in WebAPI

In my WebAPI project, I have number of apis which are decorated with `[Authorize]` attribute. ``` [Authorize] public HttpResponseMessage GetCustomers() { //my api } ``` In case user doesn't hav...

servicestack .netcore cannot resolve package

I am trying to open a .net core solution with servicestack dependencies, and for every servicestack dependency I am getting the message "The dependency ServiceStack.Core>=1.0.* could not be resolved"....

28 Feb at 09:17

ServiceStack Javascript/Typescript client and CORS

According to the documentation, I believe this is the only line required to enable CORS: `Plugins.Add(new CorsFeature());` Then from a different website: ``` var client = new JsonServiceClient('htt...

28 Feb at 02:43

How to debug Angular with VSCode?

How do I get configure Angular and VSCode so that my breakpoints work?

Migrate html helpers to ASP.NET Core

I'm converting a project to ASP.NET Core. I need to migrate lots of reusable html helpers, but html helpers do not exist in Core. Some are complex, some simple. Here's a extremely simple example: ``...

standard_init_linux.go:178: exec user process caused "exec format error"

docker started throwing this error: > standard_init_linux.go:178: exec user process caused "exec format error" whenever I run a specific docker container with CMD or ENTRYPOINT, with no regard to an...

27 Feb at 20:8

How do I use string interpolation with string literals?

I'm trying to do something like ``` string heading = $"Weight in {imperial?"lbs":"kg"}" ``` Is this doable somehow?

27 Feb at 18:46

Show Only Summary Section of BenchmarkDotNet

I'm benchmarking some .net framework stuffs, I'm using .net framework, C# and [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) What I want to do is; I'm writing a lot of benchmark tests a...

27 Feb at 18:1

Set Hangfire succeeded job expiry attribute not working

I am using Hangfire to do jobs, and I'd like to change the behaviour that succeeded jobs are deleted from the database after a day - I'd like them to be stored for a year. Following the instructions i...

23 May at 12:29

How to implement Security Protocols TLS 1.2 in .Net 3.5 framework

As Paypal updated their response, I need to update security protocols TLS to v1.2 in my existing application which is on .NET 3.5 framework. What changes required to update this in existing code, I c...

27 Feb at 11:41

Waiting until the task finishes

How could I make my code wait until the task in DispatchQueue finishes? Does it need any CompletionHandler or something? ``` func myFunction() { var a: Int? DispatchQueue.main.async { ...

The operation could not be completed. invalid pointer - Visual Studio 2015 Update 3

[](https://i.stack.imgur.com/HIEcu.jpg) Getting this error when opening `.cshtml` file: > The operation could not be completed. Invalid pointer Everything starts after installing update 3 and .Net ...

Does C# 7.0 work for .NET 4.5?

I created a project in Visual Studio 2017 RC to check whether I can use new C# 7.0 language features in a .NET Framework 4.5 project. It seems to me that after referencing `System.ValueTuple` NuGet, n...

27 Feb at 14:33

ServiceStack Log4NetFactory

How can I configure log4net in code when I like to use the servicestack logging interface? I see there is ``` LogManager.LogFactory = new Log4NetFactory(configureLog4Net:true); ``` If I got things...

27 Feb at 08:56

Can't auto-generate IDENTITY with AddRange in Entity Framework

I don't know if it's an Entity Framework's desing choice or a wrong approach on my behalf, but whenever I try to AddRange entities to a DbSet I can't seem to get the auto-generated IDENTITY fields. `...

Sending json data to client from an interface server without change

I have two type of servers which contain some information. One of them is that is used for collecting all information in one place and pass it to mobile devices. I used `httpClient` to get JSON data ...

Python Selenium Chrome Webdriver

I'm beginning the automate the boring stuff book and I'm trying to open a chrome web browser through python. I have already installed selenium and I have tried to run this file: ``` from selenium im...

Visual Studio : can't find "resource file" in list of items to add to project

I'm on VS Community 2017 RC. I'd like to add a resource file (.resx) to my project but this item type is not listed in the items[](https://i.stack.imgur.com/HeDFc.jpg) Have I missed something ? Do I ...

How to create roles in ASP.NET Core and assign them to users?

I am using the ASP.NET Core default website template and have the authentication selected as "Individual User Accounts". How can I create roles and assign it to users so that I can use the roles in a ...

convert image into blob using javascript

I use promise to download an image and get the image data like: ``` promise.downloadFile().then(function(image){ //do something }); ``` I have got the image, which is like: ```...

3 Oct at 09:41

xUnit and multiple data records for a test

I'm fairly new to Unit Testing and have the following code: ``` public class PowerOf { public int CalcPowerOf(int @base, int exponent) { if (@base == 0) { return 0; } if (exponent ...

9 Jul at 12:51

How do I change the background color of the body?

I'm using React.js and want to change the background color of the entire page. I can't figure out how to do this. Please help, thank you. Edit (Sep 2 '18): I have a project on GitHub that I'm linking...

2 Sep at 14:31