How can I use @Scripts.Render with .Net Core 2.0 MVC application?

How can I use `@Scripts.Render` with a .NET Core 2.0 MVC application? I am converting code from .NET Framework 4.6.1 to .NET Core 2.0. I have read from [here](https://learn.microsoft.com/en-us/aspnet...

13 Sep at 04:22

async Task<IActionResult> vs Task<T>

I have a controller with one action. In this action method, I have an `async` method that I call and that is it. This is the code that I am using: ``` [HttpGet] public Task<MyObject> Get() { retur...

10 Feb at 12:51

Correct use of Autofac in C# console application

I'm new using Autofac so my apologies for the noob question. I read every manual in Internet explaining the basics when using Autofac (or any other tool like Structuremap, Unity, etc). But all the exa...

Error 500 when using TempData in .NET Core MVC application

Hello i am trying to add an object to `TempData` and redirect to another controller-action. I get error message 500 when using `TempData`. ``` public IActionResult Attach(long Id) { Story search...

23 Jan at 20:13

Unity: Record video from device camera

I want a plugin or a library or a way to record video (sure with sound) in unity (windows standalone) from device camera. Currently, I am able to take screenshots using this camera. Someone says that...

27 Feb at 19:21

How do I (elegantly) transpose textbox over label at specific part of string?

I'll be feeding a number of strings into labels on a Windows Form (I don't use these a lot). The strings will be similar to the following: > "The quick brown fox j___ed over the l__y hound" I want t...

2 Feb at 04:18

Ormlite: Setting model attributes in c# no longer works

I like to keep my data models clean (and not dependent on any Servicestack DLLs) by defining any attributes just in the database layer. However since upgrading to ver 5.0, my application fails to corr...

23 Jan at 12:9

PocoDynamo - How do I change the table name at runtime for Put and Delete

I already have my tables created in DynamoDB, and I'd like to write to them using PocoDynamo. However, I need to change the table name at runtime based on the environment I'm running in. I can success...

23 Jan at 11:59

No service for type has been registered

I am trying to implement ASP.NET Core middleware, and this is the whole code I have in my project: ``` public class HostMiddleware : IMiddleware { public int Count { get; set; } public async...

Get Hub Context in SignalR Core from within another object

I am using `Microsoft.AspNetCore.SignalR` (latest release) and would like to get the hub context from within another object that's not a `Controller`. In the "full" SignalR, I could use `GlobalHost.Co...

23 Jan at 04:38

Task vs async Task

Ok, I've been trying to figure this out, I've read some articles but none of them provide the answer I'm looking for. My question is: Why `Task` has to return a Task whilst `async Task` doesn't? For ...

23 Dec at 01:29

Spring boot Autowired annotation equivalent for .net core mvc

Question mentions it all. In spring boot I am able to use the `AutoWired` annotation to inject a dependency into my controller. ``` class SomeController extends Controller { @AutoWired priv...

NPM "ENOENT: no such file or directory error" when installing Sails.js dependencies with Node 8.9.4 LTS

I recently upgraded my computer and with it, to the latest LTS version of Node and NPM: - - I have a Sails.js 0.12.14 application for which I'm trying to install NPM dependencies with `npm install`...

22 Jan at 15:17

Multitenant Identity Server 4

I'm trying to implement an IdentityServer that handles an SSO for a multitenant application. Our system will have only one IdentityServer4 instance to handle the authentication of a multitentant clien...

Is floating point arithmetic stable?

I know that floating point numbers have precision and the digits after the precision is not reliable. But what if the equation used to calculate the number is the same? can I assume the outcome would...

22 Jan at 14:53

.Net Core 2.0 Authorization always returning 401

After adding `[Authorize]` to a controller, I'm always getting a 401 from it. While debugging, I see the `return AuthenticateResult.Success` being reached, but the code of the controller never is. Wha...

Path.Combine() behaviour with drive letters

According to the official documentation regarding `Path.Combine` method: [https://msdn.microsoft.com/en-us/library/fyy7a5kt(v=vs.110).aspx](https://msdn.microsoft.com/en-us/library/fyy7a5kt(v=vs.110)....

20 Jun at 09:12

Why does System.Decimal ignore checked/unchecked context

I just stumbled into a `System.Decimal` oddity once more and seek an explaination. When casting a value of type `System.Decimal` to some other type (i. e. `System.Int32`) the [checked keyword](https:...

22 Jan at 13:48

Why can constants be implicitly converted while static readonly fields cannot?

Given the below code, I wonder why `referenceValue = ConstantInt;` is valid while `referenceValue = StaticInt;` fails to compile. ``` namespace Demo { public class Class1 { private c...

22 Jan at 10:24

create react app not picking up .env files?

I am using [create react app](https://github.com/facebookincubator/create-react-app) to bootstrap my app. I have added two `.env` files `.env.development` and `.env.production` in the root. My `.env...

22 Jan at 14:46

Do binding redirects in app.config for class libraries do anything?

The VS solutions I often work with consist of a (console app, web app) and that are all referenced by the executable. When working with NuGet and installing packages, there's often an `app.config` ...

Google Colab: how to read data from my google drive?

The problem is simple: I have some data on gDrive, for example at `/projects/my_project/my_data*`. Also I have a simple notebook in gColab. So, I would like to do something like: ``` for file in g...

22 Jan at 08:23

How to use Dependency Injection in .Net core Console Application

I have to add data to my database using a Console Application. In the Main() method I added: ``` var services = new ServiceCollection(); var serviceProvider = services.BuildServiceProvider(); var con...

.NET CSV Uploader Allow Nulls

I've put together a CSV importer which I assume works, though I get this error, how do I allow this column to be null so when it adds it to the table it automatically sets the ID? I've tried: csv.Co...

6 May at 07:20

How to consume a Scoped service from a Singleton?

How should I inject (using .NET Core's built-in dependency injection library, MS.DI) a `DbContext` instance into a Singleton? In my specific case the singleton is an `IHostedService`? ### What have I...