Explain 2 pairs of parentheses in expression.Compile()()
Could you please explain what this strange code does? ``` expression.Compile()(); ``` Why are there 2 pairs of parentheses here? I didn't find anything in google. The full method is ``` public Val...
- Modified
- 3 Jan at 14:51
How to use PEM certificate in Kestrel directly?
I want to use HTTPS in my ASP.Net Core 2.0 (with Kestrel web server) application. [The official documentation](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?tabs=aspnetc...
- Modified
- 3 Jan at 13:6
(C#) What is an entity?
I try to read C# ECMA to find out what an `entity` is but failed. Is this a instance of class? Or types+members? Or any single word in the code that shows no red wavy line under it?
C# intellisense not working in VS Code
I am using Visual Studio Code and I have already loaded C# OMNISharp plugin to my system and it works all fine in my existing project/solutions. However, I just created a new solution and a new proje...
- Modified
- 16 Jan at 16:36
Unable to resolve service for type IOptions[DataAccessConfiguration] in non-ASP.NET Core app
All of our business services were previously set up to use Dependency Injection with IOptions because they were being consumed by ASP.NET Core apps, like so: NotificationDataAccess.cs: ``` public cl...
- Modified
- 3 Jan at 01:18
MVC/JQuery validation does not accept comma as decimal separator
Even though it was suggested, that this is rather a jQuery problem than an MS ASP MVC problem, I think it is an MVC Problem. I've created the whole app in asp.net core 2.0 MVC and the error persist....
- Modified
- 23 Feb at 22:13
Nullable Owned types in EF Core
I my case I want to store an address but it has to be optional. My mapping lookes like this: But when comitting my DbContext with Address as null iam getting this error: > InvalidOperationException: T...
- Modified
- 5 May at 14:13
Merging web.configs between projects
I have a common web project which is used as a base for several "child" web projects. Is it possible to apply a web.config transform/merge between projects? Let's say the structure looks like this: `...
- Modified
- 4 Jan at 19:37
Why can't I call the UseInMemoryDatabase method on DbContextOptionsBuilder?
First off, I can't use SQL Lite. Secondly the code below is giving me: > Error CS1061 'DbContextOptionsBuilder' does not contain a definition for 'UseInMemoryDatabase' and no extension method 'UseI...
- Modified
- 14 Jun at 23:37
How to format numbers in scientific notation with powers in superscript
I need to write values like: ``` 9.6 x 10² 9.6 x 10¹² ``` I need to know if there is a way to format numbers as above in a string.
- Modified
- 2 Jan at 22:18
System.* reference troubles when introducing NETStandard.Library dependency
In a large solution with 52 projects (all net462), the latest version of some of our dependencies are now only built for NET standard. Therefore they depend on the NuGet package `NETStandard.Library` ...
- Modified
- 29 Aug at 04:26
Access Configuration/Settings on static class - Asp Core
I have 3 solutions. Project.Web, Project.Core (Business), and Project.Layer(Models). In Project.Core, I have a static file that I can call like this `Business.GetAllData();` from Project.Web.Control...
- Modified
- 2 Jan at 05:46
How to make a lot of concurrent web requests using async and await?
I read the how to by Microsoft at [How to: Make Multiple Web Requests in Parallel by Using async and await (C#)][1] and found: private async Task CreateMultipleTasksAsync() { // Declare an H...
- Modified
- 6 May at 07:20
Use IAmazonDynamoDB or IDynamoDBContext (both?)
I started my Visual Studio project from AWS SDK template. It uses IDynamoDBContext in the function and IAmazonDynamoDB in the tests. Everything worked to save and received documents when I received th...
- Modified
- 2 Jan at 20:31
AspNet Core Identity, how set options.Cookie.SameSite?
In the latest templates and libraries used httpsonly flag. How can I turn it off? This same question is outdated and it did not have full configuration sample: [AspNet Core Identity - cookie not get...
- Modified
- 1 Jan at 19:10
How to get more detailed exception in ABP?
I created a CrudAppService. When I invoke its dynamic API by using , I get a generic `500` error with this description: ``` { "result": null, "targetUrl": null, "success": false, "error": { ...
- Modified
- 10 Jan at 05:14
How to use dependency injection with inheritance in C#
# Introduction Hi everyone, I'm currently working on a persistence library in C#. In that library, I have implemented the repository pattern where I'm facing a SOLID issue. Here is a simplified exa...
- Modified
- 15 Nov at 11:44
Dynamically access table in EF Core 2.0
I am using `System.Linq.Dynamic.Core` to dynamically add in lambda expressions to queries in EF. I want to also be able to select the table by name. I found this answer: [https://stackoverflow.com/a...
- Modified
- 31 Dec at 10:48
How to programmatically interact with winlogon?
I have a Windows Service that I want to use to programmatically unlock the workstation, using the account username and password. This article [https://technet.microsoft.com/en-us/library/dn751047(v=w...
- Modified
- 9 Jan at 11:8
Cast Task<T> to Task<object> in C# without having T
I have static class full of extension methods where each of the methods is asynchronous and returns some value - like this: ``` public static class MyContextExtensions{ public static async Task<boo...
- Modified
- 2 Jan at 13:23
Visual Studio 2017 publish ASP.NET Core app with C# 7.2
I have a Asp.Net MVC Core website that's using `public static async Task Main()`. For that to work I've set the language version to C# 7.2 (in the properties -> build -> advanced dialog, double checke...
- Modified
- 9 Jan at 12:29
Listing USB devices via their USB class
I am trying to dynamically list the USBs connected to the computer that match a certain [UsbDeviceClass](https://learn.microsoft.com/en-us/uwp/api/windows.devices.usb.usbdeviceclass) The information a...
- Modified
- 23 Dec at 00:1
How to get an instance of IConfiguration in asp.net core?
I making a unittesting project to test my webapi and i need to initialize a controller the problem is that in the constructor it receive a IConfiguration that it is provide by dependency-injection and...
- Modified
- 29 Dec at 04:26
Not much difference between ASP.NET Core sync and async controller actions
I wrote a couple of action methods in a controller to test the difference between and controller actions in ASP.NET core: ``` [Route("api/syncvasync")] public class SyncVAsyncController : Controlle...
- Modified
- 28 Dec at 22:41
Searching an int column on the basis of a string value
I have a View `View_Booking` in sql server 2014: ``` bkID bkSlot bkStatus ---- ------ -------- 2 Lunch 1 4 Lunch 1 6 Dinner 0 7 Lunch 1 ``` While ...
- Modified
- 29 Mar at 19:9