ServiceStack OrmLite Many to One Relationship
I just started using Service Stack ORMLite for SQL Server and not able to figure out a few things. Let me show you by example, what I am trying to achieve: I have 2 tables - Users and Roles ``` publ...
- Modified
- 16 Dec at 18:30
Explain AsyncEventingBasicConsumer behaviour without DispatchConsumersAsync = true
I am trying out the RabbitMQ `AsyncEventingBasicConsumer` using the following code: ``` static void Main(string[] args) { Console.Title = "Consumer"; var factory = new ConnectionFactory() { ...
- Modified
- 24 Apr at 20:16
ASP.NET Core DI Constructor vs RequestServices
`HttpContext.RequestServices``IServiceProvider` > It is recommended to use constructor injection instead of getting it using RequestServices. --- My idea is just the opposite. Use RequestServi...
- Modified
- 16 Dec at 08:10
JS map return object
I got this array, ``` const rockets = [ { country:'Russia', launches:32 }, { country:'US', launches:23 }, { country:'China', launches:16 }, { country:'Europe(ESA)', launches:7 }, {...
- Modified
- 15 Nov at 16:40
Is it possible to deconstruct out ValueTuple parameters?
Is it possible to deconstruct a tuple which isn't returned from a method, but is an out parameter? I'm not sure I'm expressing myself correctly or even using the right terms, so here's some examples: ...
configuration.GetValue list returns null
I am trying to read a list from appsettings.json file using the `GetValue<T>` method: ``` var builder = new ConfigurationBuilder().SetBasePath(System.AppContext.BaseDirectory) .AddJso...
Xunit 2.3.0 Unable to pass dates as inline params
In xUnit 2.2 and prior versions, we were able to pass date strings as inline data when implementing a Theory. ``` [Theory] [InlineData("title 1", "testing 1", 1, "Educational", "2017-3-1", "2018-12-...
NTLM authentication HttpClient in Core
I am trying to use the HttpClient to access a REST service which requires NTLM authentication. However I keep getting a 401 Unauthorized. My code looks like this ``` private static void Main() { ...
- Modified
- 12 Feb at 14:2
PostAsJsonAsync doesnt seem to post body parameters
I have created an Azure logic app that exposes a REST endpoint. The following JSON body works fine when I call it through postman. ``` { "to": "ggtest@yahoo.com", "subject": "Hello there", ...
- Modified
- 14 Dec at 15:9
Does C# 7 have array/enumerable destructuring?
In JavaScript ES6, you are able to destructure arrays like this: ``` const [a,b,...rest] = someArray; ``` where `a` is the first element in the array, `b` is the second, and `rest` is an array with t...
- Modified
- 3 Aug at 02:29
Trim strings of ServiceStack model
Is there a way to "automatically" trim strings of a ServiceStack model based on [StringLength()] attribute before it insert/update them in the DB? I'm getting an error because the strings I'm trying ...
- Modified
- 14 Dec at 15:22
How to insert millions of data of different RDBMS in to SQL Server database with insert statement?
I have two databases in my SQL Server with each database containing 1 single table as of now. I have 2 database like below : 1) Db1 (MySQL) 2) Db2 (Oracle) Now what I want to do is fill my databas...
How to Refresh a Component in Angular
I am working on an Angular project. I'm struggling with refresh action in a component. I would like to refresh the router's components on button click. I have refresh button when I click on it the co...
- Modified
- 14 May at 14:48
Unity3D, why "scripting runtime version" is .NET3.5 but "api compatibility level" is .NET2.0? What do the two options in PlayerSettings actually mean?
I've been using Unity3D these days and checked manuals about .NET system. But felt very confused. In Unity3D Player Settings, there are two options called "scripting runtime version" and "api compati...
PySpark - Sum a column in dataframe and return results as int
I have a pyspark dataframe with a column of numbers. I need to sum that column and then have the result return as an int in a python variable. ``` df = spark.createDataFrame([("A", 20), ("B", 30), (...
How to access current HttpContext in ASP.NET Core 2 Custom Policy-Based Authorization with AuthorizationHandlerContext
How can I access current HttpContext to check for route and parameters inside AuthorizationHandlerContext of Custom Policy-Based Authorization inside ASP.NET Core 2? Ref example: [Custom Policy-Based...
- Modified
- 19 Sep at 23:28
EF Core connection string in Azure Functions .NET Core
I'm using EF core 2.0 in Azure Functions using .net core. I'm trying to read db ConnectionString from local.settings.json, which is defined: `Environment.GetEnvironmentVariable()` doesn't return any c...
- Modified
- 6 May at 00:54
BitBlt screen capture not working on Windows 10
I'm using this code to capture a process window in the background: ``` IntPtr = Process.GetProcessByName("memu")[0].MainWindowHandle; RECT rc; GetClientRect(hwnd, out rc); IntPtr hdcFrom = GetDC(hwn...
- Modified
- 4 Feb at 02:36
Pause/prevent animation for a checkbox control
I have a checkbox substituting a switch-like control. [](https://i.stack.imgur.com/hsErO.png) [](https://i.stack.imgur.com/aiUfc.gif) It works great. The only problem is that this checkbox initial ...
Is AsList() better than ToList() with IDbConnection.Query() which returns IEnumerable?
I read this answer from Marc Gravell (@MarcGravell): [https://stackoverflow.com/a/47790712/5779732](https://stackoverflow.com/a/47790712/5779732) The last line says: > As a minor optimization to you...
- Modified
- 13 Dec at 13:58
Generate Excel with merged header using NPOI?
I tried to export excel sheet using NPOI like bellow but I am unable to change the background color and set second cell value. Bellow are my code. Desired Format: [![Desired Format][1]][1] [1]: https...
Font Awesome 5 font-family issue
I integrated Font Awesome 5 in a project with bootstrap 4. When I recall a font via CSS it does not work. with Font Awesome 4 the code was as follows: ``` #mainNav .navbar-collapse .navbar-sidenav .n...
- Modified
- 23 Feb at 14:12
Dapper vs ADO.Net with reflection which is faster?
I have studied about Dapper and ADO.NET and performed select tests on both and found that sometimes ADO.NET is faster than Dapper and sometimes is reversed. I understand this could be database issues ...
- Modified
- 13 Dec at 08:13
LINQ select property by name
I'm attempting to use a variable inside of a LINQ select statement. Here is an example of what I'm doing now. ``` using System; using System.Collections.Generic; using System.Linq; using Faker; n...
- Modified
- 31 Oct at 22:43