Injecting DbContext into service layer
How am I supposed to inject my `MyDbContext` into my database service layer `MyService`? ``` public void ConfigureServices(IServiceCollection services) { services.AddDbContext<MyDbContext>(opti...
- Modified
- 9 Dec at 10:21
ServiceStack return response syntax error
I am just quickly upgrading ServiceStack to version 4.5.4 and I am having a problem trying to convert my service. Basically I cannot longer return the sql response as a string. Does anyone know the co...
- Modified
- 9 Dec at 04:4
IdentityServer "invalid_client" error always returned
I'm trying to use IdentityServer3, but don't know why I'm getting "invalid_client" error always, always no matter what I do. This is the code I'm using: ``` //Startup.cs (Auth c# project) public voi...
- Modified
- 8 Dec at 22:38
Mock IEnumerable<T> using moq
Having this interface, how can I mock this object using moq? ``` public interface IMyCollection : IEnumerable<IMyObject> { int Count { get; } IMyObject this[int index] { get; } } ``` I get:...
- Modified
- 27 Jan at 13:29
Cap string to a certain length directly without a function
Not a duplicate of [this](https://stackoverflow.com/q/2776673/3785314). I want to make a string have a max length. It should never pass this length. Lets say a 20 char length. If the provided string ...
ServiceStack.Redis timeout on Azure
I'm moving my ServiceStack API from Linux/Mono (On my own hardware) to the Azure App Service, using SS 4.5.2. My Redis cache is 3.2 running on a Linux VM. I am using the Azure Redis service. I'm se...
- Modified
- 8 Dec at 19:35
How can I upload a file and form data using Flurl?
I'm trying to upload a file with body content. Is `PostMultipartAsync` the only way? On my C# backend code I have this: ``` var resource = FormBind<StorageFileResource>(); var file = Request.Files....
Why is the Linq-to-Objects sum of a sequence of nullables itself nullable?
As usual, `int?` means `System.Nullable<int>` (or `System.Nullable`1[System.Int32]`). Suppose you have an in-memory `IEnumerable<int?>` (such as a `List<int?>` for example), let us call it `seq`; the...
- Modified
- 8 Dec at 13:32
Fastest way to map result of SqlDataReader to object
I'm comparing materialize time between Dapper and ADO.NET and Dapper. a few result show that Dapper a little bit faster than ADO.NET(almost all of result show that it comparable though) So I think I...
- Modified
- 9 Apr at 12:34
Is there any way to convert .dll file to .cs files
Is there any way to convert .dll file to .cs files? I am searching for any tool or online website what can convert .dll file into .cs files. If any one have any info please inform Thanks in advance. ...
- Modified
- 8 Dec at 12:13
Visual Studio C++/CLI Mysterious Error With Template
Well, I've been trying to make a C++ DLL in Visual Studio 2015, which took a while since I'm not very good with Visual Studio. I need to access the .NET libraries, specifically System::Management. (W...
- Modified
- 8 Dec at 02:31
Query LOCAL Bitcoin blockchain with C# .NET
I am trying to check the of a given Bitcoin address by using the locally stored blockchain (downloaded via Bitcoin Core). Something similar to this (by using NBitCoin and/or QBitNinja), but without ...
- Modified
- 27 Dec at 18:10
ServiceStack - Dynamic/Object in DTO
I am running into an issue while looking at SS. I am writing a custom Stripe implementation and got stuck on web hooks, this in particular: [https://stripe.com/docs/api#event_object](https://stripe.c...
- Modified
- 7 Dec at 21:9
Volatile variables
I recently had an interview with a software company who asked me the following question: > Can you describe to me what adding in front of variables does? Can you explain to me why it's important? M...
Why use Attach for update Entity Framework 6?
While searching for the best practivies of performing CRUD operation via EF I noticed that it is highly recommended to use `Attach()` or `Find()` methods before updating an entity. It works well and a...
- Modified
- 7 Dec at 19:9
Is there a way to check if a mock has setup for a member?
I have a need for doing: ``` if(!fooMock.HasSetupFor(x => x.Bar)) { fooMock.Setup(...); } ``` Above is pseudocode and it is the equivalent of `HasSetupFor` I'm looking for. Is this possible?
Visual Studio 2015 - "Unable to step. The operation could not be completed. A retry should be performed"
When debugging I get the following error: > Unable to step. The operation could not be completed. A retry should be performed After clicking OK, the dialog returns: > The debugger cannot continue...
- Modified
- 28 Dec at 12:34
ASP.NET MVC Core how to get application supported culture list
In my Startup.cs I added two cultures: ``` var cultureLt = new CultureInfo("LT"); var cultureEn = new CultureInfo("EN"); var supportedCultures = new List<CultureInfo> {cultureEn, cultur...
- Modified
- 7 Dec at 12:43
Accessing Certificate from within a C# Azure function
I need to access a certificate from my Azure Function. I followed the steps outlined in [Runtime error loading certificate in Azure Functions](https://stackoverflow.com/questions/40240195/runtime-er...
- Modified
- 23 May at 12:33
How to generate controller using dotnetcore command line
In Ruby on Rails, you can generate controllers using something like the following in command line: `rails generate controller ControllerName action1 action2` `...etc` Is there something similar in t...
- Modified
- 8 Apr at 23:57
Getting Scope Validating error in Identity Server 4 using JavaScript Client in asp.net core
I am getting the below error while making a request to my Identity Server application from my Javascript Client Application. I have made sure I add the scope in my Identity Server application. Bel...
- Modified
- 12 May at 19:34
Azure Functions: configure blob trigger only for new events
I have about 800k blobs in my azure storage. When I create azure function with a blobTrigger it starts to process all blobs that I have in the storage. How can I configure my function to be triggered ...
- Modified
- 7 Nov at 09:4
Forcing EventProcessorHost to re-deliver failed Azure Event Hub eventData's to IEventProcessor.ProcessEvents method
The application uses .NET 4.6.1 and the [Microsoft.Azure.ServiceBus.EventProcessorHost nuget package v2.0.2](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus.EventProcessorHost/2.0.2/), along...
- Modified
- 23 May at 12:2
How to configure Swashbuckle to ignore property on model
I'm using Swashbuckle to generate swagger documentation\UI for a webapi2 project. Our models are shared with some legacy interfaces so there are a couple of properties I want to ignore on the models....
- Modified
- 24 May at 15:33
Create a non-clustered index in Entity Framework Core
Using Entity Framework Core, I want to have a Guid PK, without suffering page [fragmentation](https://stackoverflow.com/a/14996125/852806) in the database. I have seen this [post](https://stackoverfl...
- Modified
- 23 May at 12:17