Should all Entity Framework methods use async?

Is it good practice, in Asp.Net MVC or Asp.Net Web API, to have every controller actions that query the database (even the simplest query) to use async/await pattern? I know using adds complexity, b...

Service Stack InvalidOperationException When Requesting /types/typescript

I'm using service stack to build an api on .Net Core and it all works well, but I would like to have access to the type links generated by the service, but when I request the type listing for typescri...

12 Nov at 06:48

Read an excel file on asp.net core 1.0

Hello I`m trying to upload and read an excel file on my asp.net project but all the documentation I find is for ASP MVC 5. My goal is to read the excel sheet and pass the values to an list of objects....

11 Nov at 23:43

Entity Framework Core count does not have optimal performance

I need to get the amount of records with a certain filter. Theoretically this instruction: ``` _dbContext.People.Count (w => w.Type == 1); ``` It should generate SQL like: ``` Select count (*) fr...

Generate javascript client from Servicestack api metadata/swagger

is there any way to auto-generate ServiceStack javascript (no typescript) client based on metadata/Swagger? It would be good to integrate that somehow with webpack. I am not sure is it possible to d...

26 Nov at 21:22

How do I implement a checkbox list in ASP.NET Core?

I am looking to implement a checkboxlist in ASP.NET Core, but am facing some difficulties. My ViewModel: ``` public class GroupIndexViewModel { public Filter[] Filters { get; set; } } public ...

15 May at 16:50

Re-evaluate all values in xaml page calculated by a markup-extension

In a xamarin app on a xaml page I am loading localized strings using a xaml extension (the details are described [here](https://developer.xamarin.com/guides/xamarin-forms/advanced/localization/)). For...

5 May at 13:38

In Unity, can I expose C# *Properties* in the Inspector Window?

Scripts are normally written so that public are exposed in the Inspector; is there some way to use instead? ``` // instead of this public GameObject wrongBall; // is there some way to do this (to ...

11 Jul at 19:8

ValidateInput(bool) in ASP.NET Core

In ASP.NET Framework when I want to pass HTML code from Javascript to Controller just wrote [ValidateInput(false)] before Method and no problem for me: Just like my question [here](https://stackover...

23 May at 12:0

Add message to azure storage queue without base64 encoding?

I don't have the possibility to encode my request to base64, and according to the documentation I shouldn't have to, but I can't figure it out. If I Base64 encode it's working fine: ``` <QueueMessage>...

9 Feb at 13:43

Syntax error versus compiler error in Visual Studio, or red wavy underline versus blue wavy underline

What is the difference between a "syntax error" and a "compiler error" as Visual Studio sees it? Or, put another way, why are some "compile-time" errors underlined with wavy lines and some with wav...

Response to preflight request doesn't pass access control check (Angular2)

I am getting below error on call to REST Web API in Asp.net. [http://localhost:54859/api/PostData](http://localhost:54859/api/PostData)[http://localhost:3000](http://localhost:3000) I am using Angul...

How can I deploy a C# console application as a single exe?

I have searched for this and there are a number of previous answers but all seem overly complex. I'm new to C# and Windows development in general (previous Mac developer). I have written a simple ...

11 Nov at 10:17

Testing Exception Messages with Shouldly

Is there a way to test the exception messages with shouldly? An example: ``` public class MyException: Exception{ } ``` The method to be tested: ``` public class ClassUnderTest { public void...

11 Nov at 09:23

Change flow of messages in Microsoft Bot Framework

Hello I'm new to Microsoft Bot Framework and I have a question that I couldn't find an answer to. I have a FormFlow that ask the user for some question, after a specific question I want the bot to do ...

11 Nov at 21:5

iText7 Create PDF in memory instead of physical file

How do one create PDF in memorystream instead of physical file using itext7? I have no idea how to do it in the latest version, any help? I tried the following code, but pdfSM is not properly populat...

12 Nov at 04:15

JSON.NET JObject - how do I get value from this nested JSON structure

I have this JSON: ``` { "client_id": "26075235", "client_version": "1.0.0", "event": "app.uninstall", "timestamp": 1478741247, "data": { "user_id": "62581379", "si...

6 May at 05:29

Mocking Task.Delay

I have a method with the following line: `await Task.Delay(waitTime).ConfigureAwait(false);` I there a good strategy to avoid actually waiting the few seconds when unit testing and instead verify tha...

10 Nov at 22:16

Ensure deferred execution will be executed only once or else

I ran into a weird issue and I'm wondering what I should do about it. I have this class that return a `IEnumerable<MyClass>` and it is a deferred execution. Right now, there are two possible consumers...

20 Jun at 09:12

Web API 2 routing - Route attribute

Question is regarding defining custom routes with the `Route` attribute. I know that in the `WebApiConfig` class you always define the default route, ``` configuration.Routes.MapHttpRoute("API Default...

How to extend IdentityUser with custom property

I'm using asp.net Identity 2.0 for users to log into my website, where the authentication details are stored in an SQL database. Asp.net Identity has been implemented in a standard way as can be found...

How can I support the Redis sentinel architecture using StackExchange.Redis?

My application uses the `StackExchange.Redis` package and I started using the sentinel architecture in order to support high availability and failures. I've search the web, trying to find the correct...

The AuthorizationPolicy named: 'Admin' was not found

I am learning Authentication/Authorization in .NET Core MVC. I am trying to create a controller that can only be accessed by 'Admin', but get the following error. > An unhandled exception occurred ...

Is it possible to catch net::ERR_BLOCKED_BY_CLIENT?

So on our site we have various searches some of which work fine and return the appropriate results. A few of them however return the javascript error: > Failed to load resource: net::ERR_BLOCKED_BY_C...

23 May at 12:6

How to configure AppHostBase virtual methods?

AppHostBase has two overridable methods where you can configure your inherited Application host - `Init()`- `Configure(Container container)` Is there a rule to know which is better? For instance: ...

10 Nov at 10:8