Questions

Can't enable migrations for Entity Framework on VS 2017 .NET Core

I just installed VS 2017 and created a new Core project. Inside it, I added: - - I also created a folder called Models with a class in it. Then, I went to the Package Manager Console and executed ...

Mock HttpContext for unit testing a .NET core MVC controller?

I have a function in a controller that I am unit testing that expects values in the header of the http request. I can't initialize the HttpContext because it is readonly. My controller function expe...

How to initialize IOption<AppSettings> for unit testing a .NET core MVC service?

I have a .NET core MVC rest service. I have a controller I wish to test. This controller has a constructor argument of IOptions where AppSettings is my class for config settings ( I store my database...

Package 'Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0-msbuild2-final' has a package type 'DotnetCliTool' that is not supported by project

When I use Visual Studio 2017 RC to create netcore project and Nuget Microsoft.EntityFrameworkCore.Tools.DotNet, but I get an error. > Package 'Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0-msb...

How to iterate object keys using *ngFor

I want to iterate [object object] using *ngFor in Angular 2. The problem is the object is not array of object but object of object which contains further objects. ``` { "data": { "id": 834, ...

18 Dec at 10:56

Visual Studio .net core tag helpers not working

Well, lets get down to it. I'm using Visual Studio 2015 and ASP.NET core tag helpers have completely stopped working, no idea why as I've not changed anything. I was in work one day, they worked fine,...

SlidingExpiration and MemoryCache

Looking at the documentation for [MemoryCache](https://msdn.microsoft.com/en-us/library/system.runtime.caching.cacheitempolicy.slidingexpiration.aspx) I expected that if an object was accessed within ...

6 Jan at 17:8

How to detect click/touch events on UI and GameObjects

How to detect UI object on Canvas on Touch in android? For example, I have a canvas that have 5 objects such as `Image`, `RawImage`, `Buttons`, `InputField` and so on. When I touch on Button UI obje...

30 Jul at 13:57

How to use RestSharp.NetCore in asp.net core

I have gone through the [http://restsharp.org/](http://restsharp.org/) code which work greats. Below is the code of RestSharp with out asp.net core . ``` public GenericResponseObject<T> GetGeneric<T>...

Performance of == vs Equals in generic C# class

For some reason C# does not allow == operator use in generic classes like here: If I replace == with val.Equals(value) I have code that works as expected but if I look at bytecode it looks much more c...

23 May at 12:32

Identity Server 4: adding claims to access token

I am using Identity Server 4 and Implicit Flow and want to add some claims to the access token, the new claims or attributes are "tenantId" and "langId". I have added langId as one of my scopes as be...

Replace, Insert, Delete operations on IEnumerable

I have a library that only accepts a proprietary immutable collection type. I would like to have a function that accepts one of these collections and performs some changes to this collection by return...

29 Dec at 16:58

AppSettings.json for Integration Test in ASP.NET Core

I am following this [guide](https://learn.microsoft.com/en-us/aspnet/core/testing/integration-testing). I have a `Startup` in the API project that uses an `appsettings.json` configuration file. ``` pu...

Servicestack Authentication get auth/logout

I'm noob to this and I'm trying to use auth/logout to log the user out from everywhere that the user is authenticated from the client. I get the respond 200 that the get request made through, but when...

30 Dec at 07:28

Is there ServiceStack APIs available in F# language

I am writing services using service stack in F# language. F# have types like 'option', 'tuple', etc., which is C# does not. Since service stack is implemented in C#, I am unable to manipulate these ob...

5 Aug at 12:8

WebSocket connection failed: Error during WebSocket handshake: Unexpected response code: 400

I am trying to integrate Socket.io with Angular and I'm having difficulties making a connection from the client-side to the server. I've looked through other related questions but my issue is happenin...

ASP.NET Identity - where is the salt stored?

I created a simple MVC4 app and registered a user. The usrname and password are stored in a table called: AspNetUsers. This table does not have a salt field. The way I understood is that when a use...

11 Aug at 06:32

VSCode c# add reference to custom assembly

in Visual Studio Code I simply want to add a reference to an custom c# assembly like > "../libs/mylib.dll" how can I add this dependency? I tried to add the path to the dependency but was not abl...

29 Dec at 14:38

Print Html template in Angular 2 (ng-print in Angular 2)

I want to print HTML template in angular 2. I had explored about this I got solution in angularjs 1 [Print Html Template in Angularjs 1](http://embed.plnkr.co/pzIfYGIOt7L8eFSJxWlu/) Any suggestion wo...

29 Dec at 12:29

ServiceStack can't deserialize json object with quotes in strings to dictionary<string, string>

If json object does not contains quotes, then all is okay. Help pls Exception: ``` {"ResponseStatus":{"ErrorCode":"SerializationException","Message":"Unable to bind to request 'CompanyList'","StackTr...

29 Dec at 10:49

Attaching an entity of type 'X' failed because another entity of the same type already has the same primary key value

ErrorMessage : > Attaching an entity of type 'FaridCRMData.Models.Customer' failed because another entity of the same type already has the same primary key value. This can happen when using the...

1 Jun at 20:32

Entity Framework Incrementing column value without query it before

I have a sql server with the table "contacts", in this table i have column "clicks" of type int, i want to increment its value without making a query. This is a copy of: "[Entity framework update one...

23 May at 12:33

Which way is better? Save a media file to MongoDB as array of bytes or as string?

I'm saving media files (pictures, PDFs, etc.) in MongoDB as array of bytes. I saw examples where people saved it by Encoding and Decoding array of bytes to string. What is the difference? Maybe differ...

3 Jan at 11:13

How to render an array of objects in React?

could you please tell me how to render a list in react js. I do like this [https://plnkr.co/edit/X9Ov5roJtTSk9YhqYUdp?p=preview](https://plnkr.co/edit/X9Ov5roJtTSk9YhqYUdp?p=preview) ``` class First e...

2 Aug at 06:28

How to add and remove item from array in components in Vue 2

I made a component "my-item" which contains three elements: a dropdown (populated by "itemList") and two input boxes populated from the dropdown. This component is considered a row. I am trying to ad...

29 Dec at 15:57