ORMLite error on insert with autoincrement key

I have the following `MVC 5` `Model`: ``` [Schema("dbo")] [Alias("map")] public class Map { [PrimaryKey] [Alias("id")] public int Id { get; set; } [Alias("name")] public String N...

Difference between private protected and internal protected

C# 7.2 introduced the `private protected` modifier, whats the difference to `internal protected`? From the doc: > A private protected member is accessible by types derived from the containing class,...

12 Jan at 13:33

document.getElementById replacement in angular4 / typescript?

I'm working with angular4 in my practice work, and this is new for me. In order to get HTML elements and their values, I used `<HTMLInputElement> document.getElementById` or `<HTMLSelectElement> docum...

7 May at 21:1

The entity type requires a primary key to be defined

I'm writing an ASP.NET Web API right now and everything works just fine for 2 controllers. Now I try to do exactly the same as before but this time I get a weird error: > System.InvalidOperationExce...

31 Oct at 20:55

Cannot Change Target Framework?

I came across this problem this morning that I can't change the target framework of an open source project. The Target framework option drop down is inactive/disabled. How to make it to work with .NET...

20 Jan at 02:41

.NET Standard 2.0 cannot be referenced in .NET Framework 2.0

I received an error: 'c:......\xxxx.csproj' targets '.NETStandard,Version=v2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v2.0'. WindowsFormsApp1 How to...

12 Jan at 04:0

Exclude property from type

I'd like to exclude a single property from the type. How can I do that? For example I have ``` interface XYZ { x: number; y: number; z: number; } ``` And I want to exclude property `z` to get `...

6 Dec at 09:7

ServiceStack, LeftJoin query

I have this SQL code, and I want this converted to ormlite - but I don't know how to do this the best way. ``` SELECT * FROM Job INNER JOIN Emp ON Job.JobAnsvarID = Emp.EmpId LEFT JOIN (SELECT JobI...

13 Jan at 20:26

Set the precision for Decimal numbers in C#

Is it possible to change the precision for Decimal numbers in C# globally ? In TypeScript I am using the framework [Decimal.js](https://github.com/MikeMcl/decimal.js/), where I can change the precisi...

11 Jan at 16:56

Import functions from another js file. Javascript

I have a question about including a file in javascript. I have a very simple example: ``` --> index.html --> models --> course.js --> student.js ``` course.js: ``` function Course() ...

11 Oct at 09:7

Swagger default value for parameter

How do I define default value for property in swagger generated from following API? ``` public class SearchQuery { public string OrderBy { get; set; } [DefaultValue(OrderDirection.De...

How to update/refresh overlays in GMap?

I have this problem: I have a list of points `List<PointLatLng>` and an overlay where a trajectory of the points is shown. I also use `TabPages` and inside one page there is the `gMapcontrol`. Unfort...

5 Apr at 09:53

Getting an Unauthorized error(401) from vuforia server

I am trying to implement in C# code. I am getting an error from the server. C# Code: ``` ASCIIEncoding Encoding = new ASCIIEncoding(); MD5 md5 = MD5.Create(); string requestPath = "/targets"; str...

Package 'EntityFramework 6.2.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'

I have made .net core 2.0 web app. I have added Entity Framework 6.2.0 using NUGET and then I get this error > Package 'EntityFramework 6.2.0' was restored using '.NETFramework,Version=v4.6.1' instea...

11 Jan at 06:35

MSB6003 The specified task executable "sgen.exe" could not be run. The filename or extension is too long

Running VS 2017 15.5.3 on windows 10. Getting this generic error "The specified task executable "sgen.exe" could not be run. The filename or extension is too long" When building project in Release co...

11 Jan at 03:56

C# Verbatim String Line Breaks: CRLF, CR, or LF?

I ran into an interesting problem today where my tests were failing consistently on the build machine when they worked just fine on my machine even using the same configuration. When I looked at the ...

10 Jan at 22:2

Why isn't Serilog writing Debug messages even when the level is set to Debug?

I wrote the following line to create my logger in a C#/WPF application, but the Debug messages do not show up in the logs. What am I missing? I am using serilog.sinks.file version 4.0.0. The releas...

10 Jan at 21:59

Generate and Sign Certificate Request using pure .net Framework

I am trying to use pure .net code to create a certificate request and create a certificate from the certificate request against an existing CA certificate I have available (either in the Windows Certi...

23 Dec at 19:27

How to filter NUnit tests by category using "dotnet test"

I have a project that has a ``` [TestFixture, Category("Oracle")] ``` and a ``` [TestFixture, Category("OracleOdbc")] ``` with a couple of tests which I would like to execute using `dotnet test...

23 Jan at 16:2

Systemd with multiple execStart

Is it possible to create service with the same script started with different input parameters? Example: ``` [Unit] Description=script description [Service] Type=simple ExecStart=/script.py parameters...

25 Feb at 09:19

How to get actual request execution time

Given the following middleware: ``` public class RequestDurationMiddleware { private readonly RequestDelegate _next; private readonly ILogger<RequestDurationMiddleware> _logger; public R...

How to get default value of auto property in C# using reflection?

I have this class: How do I get the "Auto-Property Initializer" value `5` using reflection? I am trying to avoid creating an instance of MyClass. It seems un-necessary.

6 May at 06:11

Mocking a SignInManager

New to unit testing with Moq and xUnit. I am trying to mock a `SignInManager` that is used in a controller constructor to build a unit test. The documentation that I can find for the `SignInManager` c...

Why is StringValues used for Request.Query values?

Let's say I have some url that looks like this: www.myhost.com/mypage?color=blue In Asp.Net Core, I'd expect to get the color query parameter value by doing the following: `string color = Request.Qu...

3 Oct at 12:52

How to use LINQ Where for generic type?

I have the following generic method that I need to be able to perform a LINQ Where query in: ``` public static List<T> GetItems<T>(Guid parentId = new Guid()) where T : new() { var db = new SQLit...

10 Jan at 13:35