What is the equivalent of .WillCascadeOnDelete(false) in EF Core?
What is the equivalent of .WillCascadeOnDelete(false) in EF Core? ``` modelBuilder.Entity<ProductTransactionHistoryClassImport>() .HasMany(e => e.ProductTransactionHistoryClassDetailI...
- Modified
- 15 Dec at 11:59
Azure Function with AD auth results in 401 Unauthorized when using Bearer tokens
I have a very simple Azure function in C# for which I've setup Azure AD Auth. I've just used the Express settings to create an App registration in the Function configuration. ``` public static class ...
- Modified
- 21 Mar at 02:49
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?
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...
- Modified
- 18 Mar at 12:16
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();...
- Modified
- 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 ...
- Modified
- 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...
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...
- Modified
- 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...
- Modified
- 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...
- Modified
- 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...
- Modified
- 17 Mar at 10:44
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...
- Modified
- 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...
- Modified
- 16 Mar at 19:3
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...
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...
- Modified
- 15 Mar at 12:23
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 ...
- Modified
- 15 Mar at 13:26
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...
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...
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...
- Modified
- 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> ...
- Modified
- 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...
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...
- Modified
- 28 Jan at 09:37
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...
- Modified
- 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...
- Modified
- 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`...
- Modified
- 12 Mar at 01:0