Questions

.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...

Where is IDbSet<T> in entity core

[](https://i.stack.imgur.com/noyBE.png) ``` public abstract class RepositoryBase<T> : IRepository<T> where T : class { private ShopCoreDbContext dbContext; private readonly DbSet<T> dbSet; //...

21 Jan at 08:35

How to allow migration for a console application?

When using asp.net core and ef core, I have no problem when invoking `add-migration init`. But when I apply the same approach on a console application below, I got an error saying: > Unable to create ...

Task does not contain a definition for Run method

I tried to implement multithreading in my code, 1st time. When i tried to use ``` Task T = Task.Run(() => { }); ``` Visual Studio is still underlines Run() with statement "Task does not contain a ...

20 Jan at 20:57

How do you buffer requests using the in memory queue with ServiceStack?

Running SS 4.0.54 at the moment and what I want to accomplish is to provide clients a service where by they can send one way HTTP requests. The service itself is simple. For the message, open a DB c...

20 Jan at 19:57

ServiceStack ServerEvents authentication configuration

I'm trying to use JWT authentication with ServiceStack ServerEvents to ensure that all users are authenticated but I can't find how to configure server events to do this. I assume that this works in t...

24 Jan at 08:36

How can I implement ISerializable in .NET 4+ without violating inheritance security rules?

Background: [Noda Time](https://nodatime.org) contains many serializable structs. While I dislike binary serialization, we received many requests to support it, back in the 1.x timeline. We support it...

How to (should I) mock DocumentClient for DocumentDb unit testing?

From the new CosmosDb emulator I got sort of a repository to perform basic documentdb operations, this repository gets injected to other classes. I wanted to unit test a basic query. ``` public clas...

24 Jan at 18:27

Efficiency of very large collections; iteration and sort

I have a csv parser that reads in 15+ million rows (with many duplicates), and once parsed into structs, need to be added to a collection. Each struct has properties Key (int), A(datetime), and B(int...

19 Jan at 17:0

batch file from scheduled task returns code 2147942401

I am trying to schedule a job to run a batch file with Windows 10 Task Scheduler, but it results in return code 2147942401. The batch file is on remote location so I am giving the absolute path "\\se...

23 Jan at 11:5

Why does pattern matching on a nullable result in syntax errors?

I like to use `pattern-matching` on a `nullable int` i.e. `int?`: ``` int t = 42; object tobj = t; if (tobj is int? i) { System.Console.WriteLine($"It is a nullable int of value {i}"); } ```...

11 Apr at 16:11

Async programming and Azure functions

In the Azure functions "Performance considerations" part, [Functions Best Practices](https://learn.microsoft.com/en-us/azure/azure-functions/functions-best-practices), under "Use async code but avoid ...

8 Apr at 22:24

Return "raw" json in ASP.NET Core 2.0 Web Api

The standard way AFAIK to return data in ASP.NET Core Web Api is by using `IActionResult` and providing e.g. an `OkObject` result. This works fine with objects, but what if I have obtained a JSON stri...

19 Jan at 08:12

The listener for function was unable to start. Why?

I'm getting the following error when I run the azure function from visual studio. > A ScriptHost error has occurred [1/19/2018 6:40:52 AM] The listener for function 'MyFunctionName' was unable to s...

22 Mar at 11:24

Send messages to Whatsapp number using PHP

I have to send messages to the customer's programatically. What are the pre requirements/needs? Do I need to convert/register my personal number to business account? Is there any provided by fo...

8 May at 07:22

Unable to open the NuGet Package Manager Console

When I try to open the I get the following error. Am not sure what is preventing the Package Manager Console to open. ``` Each package is licensed to you by its owner. NuGet is not responsible for, ...

6 Aug at 14:43

Error: "is not recognized as an internal or external command, operable program or batch file"

Whenever I try and run `mycommand.exe` from my Windows `cmd.exe` terminal, I get this error: > ''mycommand.exe' is not recognized as an internal or external command, operable program or batch file' I...

13 Dec at 11:15

Short running background task in .NET Core

I just discovered `IHostedService` and .NET Core 2.1 `BackgroundService` class. I think idea is awesome. [Documentation](https://learn.microsoft.com/en-us/dotnet/standard/microservices-architecture/mu...

18 Jan at 12:25

.NET: file uploading to server using http

I have a running-state `.php` script that hits a URL and uploads a single/multiple files `.csv` type with a unique `token` sent with them (in the body AFAIK). Below is the working snippet: ``` <?ph...

Changing font family of all MUI components

Can we change the font family of MUI components with less code. I have tried many ways but still, I can't able to do it. I have to change the font family individually which is really a lot of work. Ar...

10 Nov at 05:24

ORMLite/Servicestack: Joining Multiple Nested Tables Together

I think this should be easy, and I'm not sure if I'm just missing something or if this feature is missing from ServiceStack/ORMLite currently. I've got a tablestructure that looks something like this:...

C# 7 ref return for reference types

I'm going through some code that uses the new features of C# 7 and uses the ref locals & returns feature. It seems pretty straight forward for `value-types` where the ref local variable gets a refere...

5 Feb at 07:51

What is the best way to get the list of column names using CsvHelper?

I am trying to use CsvHelper for a project. I went through the documentation but I couldn't find a way to read all the column names with a single method. How can I get a list of all column header name...

17 Jan at 18:13

Is there an equivalent of C#'s nameof(..) in F#?

I have the following lines of code I want to port from C# to F#: ``` private const string TypeName = nameof(MyClass); private const string MemberName = nameof(MyClass.MyMember); ``` The value of `T...

18 Jan at 10:59