Questions

Use Redirect in Web Api Controller (HTTP 302 Found)

For some reason I am having lots of trouble trying to find out how to redirect (`HTTP 302 Found`) to an absolute URL from within a controller. I have tried this: ``` this.Redirect("/assets/images/avat...

EF 6 - Error Exception calling SetData with 2 argument(s)

I have a solution with multiple projects. The DBContext file and Models are in a ClassLibrary project. This project has EF 6.1.3 and it is running on .NET 4.5.2. The models and DBContext files are in ...

Registering a new DelegatingHandler in ASP.NET Core Web API

I want to create a new Handler that extends DelegatingHandler to enable me to do stuff before getting as far as the controller. I have read in various places that I need need to inherit from Delegatin...

How to update only version info in assemblyinfo.cs using cake?

I am very new to cakebuild. I want to update the version info of assemblyinfo.cs using cakebuild. `public static void CreateAssemblyInfo()` method overwrites the entire content of the assemblyinfo fi...

4 Sep at 03:29

Optimize LINQ Count() > X

Question: given `IEnumerable<>`, how to check what sequence contains more than `x` items? --- [MCVE](https://stackoverflow.com/help/mcve): ``` static void Main(string[] args) { var test = Te...

25 Aug at 13:37

Serialize parquet data with C#

Is there a way to serialize data in Apache Parquet format using C#, I can't find any implementation of that. In the oficial Parquet docs it is said that "Thrift can be also code-genned into any other ...

23 Nov at 11:16

The model item passed into the dictionary is of type .. but this dictionary requires a model item of type

[this meta post](https://meta.stackoverflow.com/questions/337063/creating-a-dupe-target-to-manage-a-plethora-of-duplicate-questions) --- I have some code and when it executes, it throws an except...

20 Mar at 09:16

Resource.designer.cs Not Updating

## Computer Specification - - - - --- ## Problem Details Resource.designer.cs Not Updating in Xamarin.Droid project. 1. Tried to delete 2. Tried to Clean content and rebuild 3. Restart...

Does Swagger (Asp.Net Core) have a controller description?

I'm building a REST service that will host multiple controllers (microservices). As a whole, lets call the service "Bob". So swagger displays "Bob" / "A collection of Bob Microservices". Then the cont...

1 Nov at 22:58

The request requires buffering data to succeed HttpClient

I'm trying to send a dictionary content to a server with `POST` method ``` public async Task<T> postConnection(string GETParam, Dictionary<string, string> values, bool isRegistration = false) { Ht...

20 Jun at 09:12

MongoDB client throws a FileNotFoundException in mscorlib

I'm using Visual Studio .NET 4.6 and [Robomongo](https://robomongo.org/) has no problem connecting to my database My imports for [MongoDB](https://www.mongodb.com/) ``` using MongoDB.Driver; using M...

22 Sep at 18:1

Fluent Validation not accepting numbers with thousands separator

I have an ASP.NET MVC 5 project with Fluent Validation for MVC 5. I am also using a jQuery masking plugin to automatically add thousands to double values. In the model I have: ``` [Display(Name = "T...

1 Nov at 23:22

Npgsql Exception while reading from stream, Postgres

I am getting this error intermittently in my code. Sometimes it happens time-after-time-after-time. Sometimes it happens 1-out-of-10 times. I am not doing anything unique or special in my SQL unlik...

1 Nov at 16:59

A second operation started on this context before a previous asynchronous operation completed

``` "System.NotSupportedException was unhandled Message: An unhandled exception of type 'System.NotSupportedException' occurred in mscorlib.dll Additional information: A second operation started on ...

EntityFramework Core relation to composite key

Consider the following database tables. Unfortunately the tables cannot be altered in any way. [](https://i.stack.imgur.com/TtW1q.png) `Houses` has an auto-increment ID field named `Id`, a string fi...

FindAsync and Include LINQ statements

The code I have got so far works fine ``` public async Task<ActionResult> Details(Guid? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } I...

26 Apr at 10:20

EF DBContext dispose not closing the connection

I am using the EF 6.1.0 I have below custom DBContex object as DBEntites ``` public partial class DbEntities : DbContext { public DbEntities() : base("name=DbEntities") { //...

1 Nov at 12:14

C# async / await method to F#?

I am trying to learn F# and am in the process of converting some C# code to F#. I have the following C# method: ``` public async Task<Foo> GetFooAsync(byte[] content) { using (var stream = new M...

1 Nov at 12:24

how to unit test service stack and visual studio

I create a service stack mvc template that include 4 project using visual studio 2013 - Web application - .ServiceInterface -.ServiceModel =.Tests I am trying to write unit test ,but when i click...

31 Oct at 21:10

Specify max length attribute to match varchar(max)

I have a model like so: ``` public int Id { get; set; } [Required] [StringLength(50, MinimumLength = 3)] public string Title { get; set; } [Required] [StringLength(50, MinimumLength = 3)] public st...

31 Oct at 20:44

Pinch, and other multi-finger gestures, in modern Unity3D?

In modern Unity3D, we use the IPointerDownHandler family of calls. Regarding the `IPointerDownHandler` family of calls, ``` public class FingerMove:MonoBehaviour, IPointerDownHandler... { publ...

20 Jun at 09:12

How to redirect www to non www rule in AspNetCore 1.1 preview 1 with RewriteMiddleware?

Using the AspNetCore 1.1 bits and the new [RewriteMiddleware](https://github.com/aspnet/BasicMiddleware/tree/dev/src/Microsoft.AspNetCore.Rewrite) I wrote something like this into the `Startup.cs` to ...

30 Oct at 23:2

Automatically generate lowercase dashed routes in ASP.NET Core

ASP.NET Core uses CamelCase-Routes like [http://localhost:5000/DashboardSettings/Index](http://localhost:5000/DashboardSettings/Index) by default. But I want to use lowercase routes, which are delimit...

Instantiating objects with .NET Core's DI container

I'm using an `IServiceCollection` to create a list of required services for my objects. Now I want to instantiate an object and have the DI container resolve the dependencies for that object ``` //...

30 Oct at 23:16

How to change font color from C# in WPF

I have created a simple Calendar application and I would like to change the color of names of the days that are displayed. I created a simple condition: ``` if (nameDay.Text.Equals("Sunday")) { d...

30 Oct at 20:42