Issues with Memory Cache. TryGetValue returns false

In this code snippet i simply put null in MemoryCache and then check if this key exists: `isInCache` is false in this case. Is this behavior expected?

4 Jun at 03:40

OrmLite pass tuple of parameter

I want to pass a list of objects with two properties as a parameter in a ServiceStack OrmLite query but it is run an error Parameter class: ``` public class Configuration { public int R...

How to store and retrieve objects in Session state in ASP.NET Core 2.x?

``` DataTable dt = sql.GetDataTable("select * from EmpDetails where EmailId = '" + EmailId + "'"); string strempstatus = dt.Rows[0]["Status"].ToString(); string EmpStatus = strempstatus.TrimEnd();...

25 Aug at 00:14

Use dependency injection in static class

I need to use Dependency Injection in a static class. the method in the static class needs the value of an injected dependency. The following code sample demonstrates my problem: ``` public static ...

29 May at 12:22

Error: EBUSY: resource busy or locked, rmdir

The error occurs after following steps in windows: 1. Open one terminal: npm run start:dev 2. Open another terminal: ng build --watch However, it works in Mac by using the above commands. Part of...

17 Mar at 23:22

Give values to ServiceStack DTO Angular 6

I have a form that is used to create a object of type Equipment, with the properties, name and id. When I submit the form, I get the data. Into the Equipment object. ``` var result: Equipment = this...

17 Mar at 22:14

Cors configuration issues when using ServiceStacks JsonServiceClient

I have issues when trying to Post data to my API using ServiceStack's JsonServiceClient. I get the following error message in the console Access to fetch at '[https://192.168.10.191:5001/json/reply...

17 Mar at 17:45

How to copy code from Visual Studio to MS Word with EVERY highlight exactly as it is?

I am making a report about my program and I need copy all the code to an MS document. The problem is that I need to keep every colour as it is. I've tried using Notepad++ for this and online converter...

17 Mar at 16:43

How to run dotnet core app with Selenium in Docker

I have dotnet core 2.2 (aspnet core) app running in Docker container. I'm using the simplest possible Dockerfile you can find in any basic tutorial: - `microsoft/dotnet:2.2-sdk`- - - - - `microsoft/d...

Using ServiceStack's ServiceClient

I got recommended in another thread that I should use ServiceClient when using a ServiceStack API. I would like to create a template function that can post any type of objects like this: ``` publ...

17 Mar at 01:16

How to protect swagger endpoint in .NET Core API?

I have an api build in .net core 2.1. To restrict access to various endpoints, I use IdentityServer4 and [Authorize] attribute. However, my goal during development is to expose the api swagger documen...

Scroll to specified part of page when clicking top navigation link in Blazor

How can I make a simple "jump to" part of already loaded page in Blazor? Like this in HTML: ``` <a href="#contact">Contact us</a> ... <section id="contact"> ``` Ideally I also want to have it smoot...

15 Mar at 16:19

Next.js: Router.push with state

I'm using next.js for rebuilding an app for server side rendering. I have a button that handles a search request. In the old app, the handler was this one: ``` search = (event) => { event.preven...

Set readonly fields in a constructor local function c#

The following does not compile. ``` public class A { private readonly int i; public A() { void SetI() { i = 10; } SetI(); } } ``` It ...

The POST method is not supported for this route. Supported methods: GET, HEAD. Laravel

I have a problem with my edit page. When I submit I get this error: > The POST method is not supported for this route. Supported methods: GET, HEAD. I have no clue where it comes from as I am prett...

13 Feb at 16:39

What are Range and Index types in C# 8?

In C# 8, two new types are added to the System namespace: [System.Index](https://learn.microsoft.com/en-us/dotnet/api/system.index) and [System.Range](https://learn.microsoft.com/en-us/dotnet/api/syst...

26 Nov at 00:24

How to setup ServiceStack ServerEvents with Redis backpane geographically distributed

My situation is this: Site "A" (Romania): multiple apphost (1 per PC) exanging serverevents using Redis Backpane. Site "B" (Turkey): multiple apphost (1 per PC) exanging serverevents using Redis Back...

15 Mar at 07:59

Tensorflow 2.0 - AttributeError: module 'tensorflow' has no attribute 'Session'

When I am executing the command `sess = tf.Session()` in Tensorflow 2.0 environment, I am getting an error message as below: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> ...

20 Jun at 09:12

On double parsing in C#

I have the following code: ``` var d = double.Parse("4796.400000000001"); Console.WriteLine(d.ToString("G17", CultureInfo.InvariantCulture)); ``` If I compile and run this using an x86 configuratio...

13 Mar at 09:27

Unable to create an object of type '[DBContext's Name]'. For the different patterns supported at design time

I'm following one of Mosh Hamedani Course on ASP.NET MVC in Udemy. I came across one error while designing my Database using code-first (Entity Framework). At first, I got the error of . After resolvi...

How to get unique file identifier from a file

Before you mark this question as duplicate please read what I write. I have checked many questions in a lot of pages for the solution but could not find anything. On my current application I was using...

15 Mar at 10:35

Unreachable code, but reachable with an exception

This code is part of an application that reads from and writes to an ODBC connected database. It creates a record in the database and then checks if a record has been successfully created, then return...

23 Mar at 15:18

NullReferenceException with Nullable DateTime despite null check

`GetTodayItemCount()` attempts to get today's item count using `CreatedDtt` in the `Items` model. Because `CreatedDtt` is a Nullable Datetime (`DateTime?`), I use a ternary operator within the `Where`...

12 Mar at 01:0

Handling Model Binding Errors when using [FromBody] in .NET Core 2.1

I am trying to understand how I can intercept and handle model binding errors in .net core. I want to do this: ``` // POST api/values [HttpPost] public void Post([FromBody] Thing value) ...

Separate title string with no spaces into words

I want to find and separate words in a title that has no spaces. Before: > ThisIsAnExampleTitleHELLO-WORLD2019T.E.S.T.(Test)"Test"'Test'[Test] After: > This Is An Example Title HELLO-WORLD 2019 T....

12 Mar at 01:57