How to update record using Entity Framework Core?

What is the best approach to update database table data in Entity Framework Core? 1. Retrieve the table row, do the changes and save 2. Use keyword Update in DB context and handle exception for item ...

9 Dec at 17:58

how to undo pending changes of files that are unchanged?

One thing that drives me crazy with TFS is the fact that if you have a file checked out, but you made no changes to it, it still shows as a change, distracting you from real changes that you made. Thi...

10 Oct at 01:46

What are the benefits of C# 7 local functions over lambdas?

The other day in one of my utilities, ReSharper hinted me about the piece of code below stating that lambda defining the delegate `ThreadStart` can be turned into a local function: ``` public void St...

9 Oct at 22:44

What is the best way to compress a request to asp.net core 2 site using HttpClient?

I am sending request that can be significantly big(~1Mb) and I am seeing a large delay betweeen when I make the request and when asp.net core logs that it is handling the request. I think I can cut do...

Is there a way to force npm to generate package-lock.json?

I deleted it by accident and have made many changes to `package.json` since. An `npm install` or `npm update` do not generate `package-lock.json` anymore. I tried clearing my npm cache and my nvm cach...

10 Jun at 18:41

What's the idiomatic way to verify collection size in xUnit?

I have in my test suite a test that goes something like this: ``` [Fact] public void VerifySomeStuff() { var stuffCollection = GetSomeStuff(); Assert.Equal(1, stuffCollection.Count()); } ```...

13 May at 02:0

Where to store my Git personal access token?

Is it necessary to store the personal access token somewhere locally on the machine after generating it in GitHub? If yes, is there any preferred way where it could be stored?

17 Nov at 11:4

Is there any technical reason to write a catch block containing only a throw statement?

Disclaimer: It is well known that `catch (ex) { throw ex; }` [is bad practice](https://stackoverflow.com/q/881473/87698). This question is about that. --- While digging through Microsoft referen...

10 Oct at 14:16

code . is not recognized as an internal or external command

I want to open a directory using cmd in visual studio code but its giving me an error in cmd. So, what setting is required for that? ``` D:\RND>code . ```

26 Feb at 10:34

firebase.firestore() is not a function when trying to initialize Cloud Firestore

When I try to initialize Firebase Cloud Firestore, I ran into the following error: > Uncaught TypeError: .firestore is not a function I installed firebase with `npm install firebase --save` previou...

C# .NET MVC Service Stack How to access custom user session from Authentication Filter

I have e .NET MVC5 Application with ServiceStack. In an AuthenticationFilter I want to check whether a particular property is in the session. In AuthController: ``` var customerSession = SessionAs<C...

8 Oct at 14:22

Serilog With API App in Azure

I've integrated Serilog into WebApi project developed with Asp.Net Core 2.0 This is the configuration code in `Program.cs`: ``` Log.Logger = new LoggerConfiguration() .Enrich.FromLogContext()...

ambiguity in package references version

In a project, there are several references to Ninject library which have their version, and the unit test fails, this is the error : > Message: System.IO.FileLoadException : Could not load file or as...

3 Apr at 11:17

What is the default user and password for elasticsearch?

I have [installed Elastic with Docker](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html): ``` docker run -p 9200:9200 \ -p 9300:9300 \ -e "discovery.ty...

How to get the value from DapperRow in a query that returns a single result

I've done the following SQL query: ``` SELECT SUM(SI.UnitaryValue) as Amount FROM Services as S INNER JOIN ServicesItems as SI ON S.ServiceId = SI.ServiceId WHERE S.ServiceId = @ID" ``` In...

7 Oct at 09:21

Angular - ng: command not found

I'm trying to learn Angular and my knowledge in terminal is beginner. After I installed Angular and then type `ng new my-project`. I get the response `ng: command not found`. I've seen other posts tha...

24 Dec at 20:23

The *deps.json file in .NET Core

What is the purpose of *deps.json file in .NET Core? What is the reason to store references in such file and not in assembly manifest(as in standalone .NET Framework)? Using Ildasm i checked that ass...

Can I merge table rows in markdown

Is there a way to create merged rows in a column of table in markdown files like ReadMe.md files? Something like this: [](https://i.stack.imgur.com/Z4k5w.png)

How do I target .NET Standard 2.0 in a freshly created .NET Core 2.0 web app?

I've just created a fresh project using `dotnet new web`. My Google-foo may be failing me, but I didn't find anything relating to my answer (please link to another SO answer, or relevant documentation...

What are the ways to secure Azure functions

I have written 5 Azure functions in Azure Portal using c#. Below are the steps to install my application:- - - - - - Above process will be executed on the Customer Edge node. The authorization u...

What are hidden dependencies?

Could someone please give me an example of a hidden dependency. I've googled it, and found results like this: > "A visible dependency is a dependency that developers can see from a class's interfa...

How to display multiple images in one figure correctly?

I am trying to display 20 random images on a single Figure. The images are indeed displayed, but they are overlaid. I am using: ``` import numpy as np import matplotlib.pyplot as plt w=10 h=10 fig=pl...

8 Oct at 05:4

How to import a csv-file into a data array?

I have a line of code in a script that imports data from a text file with lots of spaces between values into an array for use later. ``` textfile = open('file.txt') data = [] for line in textfile: ...

7 Oct at 01:49

Uncaught SyntaxError: Unexpected token u in JSON at position 0

Only at the checkout and on individual product pages I am getting the following error in the console log: ``` VM35594:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0 at JSON.pars...

15 Oct at 19:22

Can I teach ReSharper a custom null check?

ReSharper is clever enough to know that a `string.Format` requires a not-null `format` argument so it warns me about it when I simply write ``` _message = string.Format(messageFormat, args); ``` wher...

7 May at 02:1