What is the best way to use Razor in a console application

I know similar questions have been asked before, but the only answers are six years old, and the projects people refer to seem like they're not being maintained. I want to use Razor in a console app o...

19 Mar at 14:28

span<T> and streams

I have been reading about span for a while now, and just tried to implement it. However, while I can get span to work I cannot figure out how to get a stream to accept it like they do in the examples....

3 Sep at 20:48

HttpClient PostAsync does not return

I've seen a lot of question about this, and all points to me using ConfigureAwait(false), but even after doing so, it still doesn't returned any response. When I run the debugger, the code stops at th...

Deserialize Boolean from Soap using Servicestack

I am issuing a soap request from SSRS to servicestack and no matter what I try, I can't get Servicestack to recognize anything as a boolean value and deserialize it. ``` [DataContract] [Route("/Stuff...

27 Apr at 23:27

What does Microsoft.Common.props do

I noticed that when I create a project using Class Library template the .csproj contains import of Microsoft.Common.props ``` <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsof...

27 Apr at 20:5

Create Unique constraint for 'true' only in EF Core

I have a class for tracking attachments to a Record. Each Record can have multiple RecordAttachments, but there is a requirement that there can only be one RecordAttachment per-Record that is marked a...

27 Apr at 20:28

Equivalent of c# class virtual member in TypeScript

So in C# when I've been creating model classes and lazy loading things, I do something like this: ``` public int? User_ID { get; set; } public int? Dept_ID { get; set; } ``` Then a little farther d...

Pandas Dataframe or similar in C#.NET

I am currently working on implement the C# version of a Gurobi linear program model that was earlier built in Python. I have a number of CSV files from which I was importing the data and creating pand...

27 Apr at 15:31

How to force hangfire server to remove old server data for that particular server on restart?

I am showing list of hangfire servers currently running on my page. I am running hangfire server in console application but the problem is when I don't have my console application running still hangf...

30 Apr at 06:59

How to create a Kafka Topic using Confluent.Kafka .Net Client

It seems like most popular .net client for Kafka ([https://github.com/confluentinc/confluent-kafka-dotnet](https://github.com/confluentinc/confluent-kafka-dotnet)) is missing methods to setup and crea...

'IJsonHelper' does not contain a definition for 'Encode'

I want to convert a list of strings to a javascript array in my view, and I've found the below suggestion in a few places on the internet: ``` @model IEnumerable<DSSTools.Models.Box.BoxWhiteListUser>...

27 Apr at 06:28

How to return XmlDocument as a response from a ServiceStack API

We are having a few ServiceStack APIs which are being called from an external tool. This tool expects the input of "XmlDocument" type, and there is no provision to write code to convert a string to Xm...

26 Apr at 12:15

VS 2017 immediate window shows "Internal error in the C# compiler"

I use Visual Studio 2017 (15.6.6). When debugging, I try to evaluate simple expressions like `int a = 2;` in the immediate window. An error > Internal error in the C# compiler is thrown. I tried to...

Get defined Route from Dto

I've created a basic Dto Hit tracker that counts how many times a ServiceStack API is requested. What I'm trying to get now is the Route that was defined for the current Dto in the ServiceBase using R...

26 Apr at 08:13

Find unused / unnecessary assemblyBinding redirects

It seems like there is so many binding redirects in our that I either: 1. look unnecessary 2. are for assemblies I don't see being referenced anywhere in our solution This is just a sample of so...

OrmLite (ServiceStack): Only use temporary db-connections (use 'using'?)

For the last 10+ years or so, I have always opened a connection the database (mysql) and kept it open, until the application closed. All queries was executed on the connection. Now, when I see exampl...

Difference between poll and consume in Kafka Confluent library

The github examples [page](https://github.com/confluentinc/confluent-kafka-dotnet/blob/master/examples/AdvancedConsumer/Program.cs) for the Confluent Kafka library lists two methods, namely poll and c...

Servicestack autoquery custom convention doesn't work with PostgreSQL

I have defined new implicit convention ``` autoQuery.ImplicitConventions.Add("%WithinLastDays", "{Field} > NOW() - INTERVAL '{Value} days'"); ``` The problem is that for postgres connection the que...

Passing IHttpClientFactory to .NET Standard class library

There's a really cool `IHttpClientFactory` feature in the new ASP.NET Core 2.1 [https://www.hanselman.com/blog/HttpClientFactoryForTypedHttpClientInstancesInASPNETCore21.aspx](https://www.hanselman.co...

Network issues and Redis PubSub

I am using ServiceStack 5.0.2 and Redis 3.2.100 on Windows. I have got several nodes with active Pub/Sub Subscription and a few Pub's per second. I noticed that if Redis Service restarts while there ...

Servicestack as SSRS datasource

I am trying to use servicestack as a datasource for my SSRS report. Is this possible? Right now I have a simple operation that takes a date as a parameter, looks like this in C# ``` [DataContract] ...

26 Apr at 19:20

Why isn't there an implicit typeof?

I think I understand why this small C# console application will not compile: ``` using System; namespace ConsoleApp1 { class Program { static void WriteFullName(Type t) { ...

25 Apr at 01:0

The seed entity for entity type 'X' cannot be added because the was no value provided for the required property "..ID"

I'm playing wit . I have troubles with HasData (Seed) method in `OnModelCreating(ModelBuilder modelBuilder)` My model is simple POCO class that has no annotation. ``` public class Tenant { publi...

Using a C# 7 tuple in an ASP.NET Core Web API Controller

Do you know why this works: ``` public struct UserNameAndPassword { public string username; public string password; } [HttpPost] public IActionResult Create([FromBody]UserNameAndPassword use...

Understanding async / await and Task.Run()

I thought I understood `async`/`await` and `Task.Run()` quite well until I came upon this issue: I'm programming a Xamarin.Android app using a `RecyclerView` with a `ViewAdapter`. In my Method, I tr...