ASP.NET Core 2 - Identity - DI errors with custom Roles

I got this code in my Startup.cs: ``` services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); servic...

21 Aug at 21:15

ASP.NET Core 2.0 authentication middleware

With Core 1.1 followed @blowdart's advice and implemented a custom middleware: [https://stackoverflow.com/a/31465227/29821](https://stackoverflow.com/a/31465227/29821) It worked like this: 1. Midd...

New .csproj format - How to specify entire directory as "linked file" to a subdirectory?

With the new `.csproj` format (as well as the old), it is possible to add files as linked outside of the project folder: ``` <EmbeddedResource Include="..\..\..\Demo\Sample.cs" Link="Resources\Sample...

Object is not extensible error when creating new attribute for array of objects

I have a function that needs to extend a javascript array, including a new attribute called `selected`: ``` export const initSelect = (data) => { let newData = data.concat(); newData.map((it...

20 Sep at 16:5

.NET Core Web API key

I am developing an application that users can authenticate via username and password and we provide a JWT token that then gets validated on the server. One thing I would like to add is the ability to...

25 Nov at 14:45

How do I deserialize an array of JSON objects to a C# anonymous type?

I have no problem deserializing a single json object ``` string json = @"{'Name':'Mike'}"; ``` to a C# anonymous type: ``` var definition = new { Name = ""}; var result = JsonConvert.DeserializeA...

30 Jan at 07:25

Get ConnectionString from appsettings.json instead of being hardcoded in .NET Core 2.0 App

I have the following class in NET Core2.0 App. ``` // required when local database does not exist or was deleted public class ToDoContextFactory : IDesignTimeDbContextFactory<AppContext> { public...

Using the Null Conditional Operator to check values on objects which might be null

I've been playing with C# 6's Null Conditional Operator ([more info here](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-conditional-operators/)). I really like the...

21 Aug at 12:28

How do I get raw request body using servicestack with content-type set to application/x-www-form-urlencoded?

I have my DTO ``` Route("/testing","POST")] public class TestingRequest:IRequiresRequestStream { public Stream RequestStream { get; set; } } ``` and my service ``` public async Task<object> Po...

21 Aug at 08:37

Servicestack doesn't have ProxyFeature with dotnet core?

Can't find ProxyFeature when using servicestack with dotnet core. Need help!

21 Aug at 08:26

Update some specific field of an entity in android Room

I am using android room persistence library for my new project. I want to update some field of table. I have tried like in my `Dao` - ``` // Method 1: @Dao public interface TourDao { @Update ...

24 Oct at 18:20

How can I setup SwashBuckle.AspNetCore.Swagger to use Authorization?

I have documented my api using Swashbuckle.AspNetCore.Swagger and I want to test some resources that have Authorize attribute on them using swagger ui. ### api ``` using Microsoft.AspNetCore.Auth...

CSS Grid Layout not working in IE11 even with prefixes

I'm using following HTML markup for my grid. ``` <section class="grid"> <article class="grid-item width-2x height-2x">....</article> <article class="grid-item">....</article> <article cla...

Unable to create migrations after upgrading to ASP.NET Core 2.0

After upgrading to ASP.NET Core 2.0, I can't seem to create migrations anymore. I'm getting > "An error occurred while calling method 'BuildWebHost' on class 'Program'. Continuing without the app...

Is .NET Core 2.0 logging broken?

I can't seem to get Trace level log information outputted after upgrading to .NET Core 2.0 (+ASP.NET Core 2.0). In fact, if I do a `dotnet new web`project and add the code below in Startup for Config...

9 Jul at 08:7

How to include a library in .NET Core 2.0

I don't know much about .NET yet, so I guess I'm missing something obvious. I created a library (targeted as a DLL file, set for .NET standard 2.0), packaged it both as a DLL file and as a NuGet pack...

What is the difference between 'it' and 'test' in Jest?

I have two tests in my test group. One of the tests use `it` and the other one uses `test`. Both of them seem to be working very similarly. What is the difference between them? ``` describe('updateAll...

28 Nov at 10:35

InvalidOperationException: No IAuthenticationSignInHandler is configured to handle sign in for the scheme

I am trying to follow the instructions [here][1] to add Cookie Authentication to my site. So far I have added the following: > Invoke the UseAuthentication method in the Configure method of the > Star...

How to resolve SmartFoxServer connection error in unity

I'm using SmartFoxServer API on Unity3d. It was working fine before I recovered my MacBook, but now gives a connection error as below: ``` Http error creating http connection: System.Net.Sockets.Sock...

25 Apr at 17:50

How to change whole solution's project's name in Visual Studio?

I have ASP.NET CORE C# project. I want to change my solution name and whole project's name. For Example : ``` OldSolution.OldName // this is Solution OldSolution.OldName.Project1 OldSolution.OldN...

15 Apr at 22:7

After updating to vs2017.3, the breakpoints will not be hit

We have an asp.net core 2.0 project (migrated from 1.x) running on Vs2017.3 (updated from 2017.2). After the update, breakpoints stop being hit. Vs reports that "The breakpoint will not currently be ...

CustomAuthorizationPolicy.Evaluate() method never fires in wcf webhttpbinding

I create a wcf service as you can see : ``` [OperationContract] [PrincipalPermission(SecurityAction.Demand, Role = "Admin")] [WebInvoke(Method = "GET", UriTemplate = "/Data/{data}")] string GetData(...

FormattedText.FormttedText is obsolete. Use the PixelsPerDip override

I am trying to populate labels to a horizontal slider and I was successfully able to do it using a class that derives from `TickBar` by passing the Text to FormattedText constructor. But now when I ta...

5 Jun at 14:51

Counting unique values in a column in pandas dataframe like in Qlik?

If I have a table like this: ``` df = pd.DataFrame({ 'hID': [101, 102, 103, 101, 102, 104, 105, 101], 'dID': [10, 11, 12, 10, 11, 10, 12, 10], 'uID': ['James', 'Henry', '...

18 Aug at 15:21

Change "Override high DPI scaling behavior" in c#

We have a control inside a WinForm (CefSharp control) that suffers from graphical artifacts when a users screen is set to 125% on windows. Its not just the control, stand alone Chrome does it to an e...

20 Jul at 09:43