Questions

What does IAppbuilder.UseWebApi do?

I've recently been working on an MVC site that has an api and in the startup.cs there is a line that says `app.UseWebApi`. I did some searching but I couldn't find a decent answer of what it does. Can...

11 Jul at 14:0

How to get normal/custom error response for an exception from an Action returning Stream in ServiceStack?

I have been venturing in the ServiceStack's [documentation](https://github.com/ServiceStack/ServiceStack/wiki/Error-Handling) regarding an issue with throwing from an Action that returns a . The iss...

12 Jul at 06:45

How to implement nhibernate session per request pattern, using Service stack's funq container as a dependency injector

I am getting the session by injecting session to service method in global.asax as 1 ``` protected void Application_Start() { this.RegisterContainer(); } ``` 2 ``` private void RegisterCont...

How to use the new IValueResolver of AutoMapper?

I am at a loss as to how to use the new `IValueResolver` interface in the new version of AutoMapper. Perhaps I used them improperly in the previous versions of AutoMapper... I have a lot of model cla...

15 Aug at 10:54

What happens when awaiting on already-completed task?

When I construct an instance of a class that I have, I would like to trigger a Token renewal function (`async` method) and let it run in the background (I keep a reference to the returned `Task`). La...

11 Jul at 12:1

Model binding in ASP.NET Core to map underscores to title case property names

I have a model class that I want to bind a query string to in my ASP.NET MVC Core (RC2) application. I need to support underscores in query string keys to confirm to OAuth specs, but I want to work w...

How can versioning be done in ASP.NET Core Web Api

In previous `asp.net web api`, I implement `DefaultHttpControllerSelector` to specify how I want the request to locate my controller. I often have different controllers with different names but intend...

How to select last record in a LINQ GroupBy clause

I have the following simple table with , and . [](https://i.stack.imgur.com/4WFKQ.png) I want to select records and `GroupBy contactId`. I used this `LINQ` extension method statement: ``` Mains.Gr...

11 Jul at 11:24

Nested FOR loops: readability & performance

I understand nested FOR loops. I understand what they do, and how they do it. But my problem is that they seem horribly unreadable to me. Take this example: ``` for (int i = 0, y = 0; y <= ySize; y+...

11 Jul at 12:21

ScrollIntoView and ListView with virtualization

I have `ListView` (virtualization is on by default), which `ItemsSource` is bound to `ObservableCollection<Item>` property. When data are populated (property is set and notification is rised) I see 2...

23 May at 12:33

What are buildOptions and preserveCompilationContext used for?

I am playing with just released ASP.NET Core. I have created new project and I am looking at `project.json`. I'd like to know what is this part of configuration for: ``` "buildOptions": { "emitEnt...

Getting Unexpected Token Export

I am trying to run some ES6 code in my project but I am getting an unexpected token export error. ``` export class MyClass { constructor() { console.log("es6"); } } ```

Application_Error() not firing

I'm trying to run an ASP.NET application that logs exceptions to the database. I'm using Application_Error to catch the exception. Before adding the connection string, just to test my code (Logger cl...

12 Jul at 18:48

ServiceStack.Text RegisterLicense throws exception

I just recently upgraded to ServiceStack.Text 4.x, the paid license. One of my apps is a console app and it uses the following code to register the license: ``` public static class License { publ...

10 Jul at 18:40

How to return value from function which has Observable subscription inside?

I dont know how to extract value from Observable to be returned by function in which Observable is present. I need just a value from it to be returned, nothing else. Current version which works ``` ...

13 Nov at 22:49

Can not open ServiceStack mvc project

I can not open ServiceStack Mvc project on visual studio 2012. This error message appears: [](https://i.stack.imgur.com/qC6Os.png) I've installed "Microsoft Visual Studio 2012 Shell (Isolated) Redi...

10 Jul at 14:40

Killing gracefully a .NET Core daemon running on Linux

I created a .NET Core console application running as a daemon on a Ubuntu 14.04 machine. I want to stop the service without forcing it, being able to handle a kill event. How can I achieve this?

10 Jul at 11:51

OWIN Configuration: What's the difference between CookieAuthenticationDefaults.AuthenticationType and DefaultAuthenticationTypes.ApplicationCookie

I'm revisiting some code in my OwinStartup class and have this definition: ``` app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.Applic...

10 Jul at 00:31

Calculate Code Metrics for .NET Core Projects?

I am playing arround with ASP.NET Core and .NET Core projects. For classic C# projects Visual Studio 2015 has got the feature to calculate code metrics. For .NET Core the support is missing in the Pre...

ASP.NET Core Browser Link `Unable to get property 'files'`

In the Microsoft Virtual Academy course ['Introduction to ASP.NET Core (formerly ASP.NET 5)'](https://mva.microsoft.com/en-US/training-courses/introduction-to-asp-net-core-formerly-asp-net-5--13786?l=...

Python's equivalent to null-conditional operator introduced in C# 6

Is there an equivalent in Python to C# [null-conditional operator](https://msdn.microsoft.com/en-us/library/dn986595.aspx)? ``` System.Text.StringBuilder sb = null; string s = sb?.ToString(); // No e...

9 Jul at 20:51

TimeSpan to Custom string like HH:mm:ss

I would like to convert ``` var delta = TimeSpan.FromSeconds(10); ``` to string like `00:00:01` I try this `delta.ToString(@"0:\\hh\\:mm\\:ss", System.Globalization.CultureInfo.InvariantCulture);...

9 Jul at 19:55

Rendering an array.map() in React

I am having a problem where I am trying to use array of data to render a `<ul>` element. In the code below the console logs are working fine, but the list items aren't appearing. ``` var Main = React....

28 Dec at 16:33

How to read data from java properties file using Spring Boot

I have a spring boot application and I want to read some variable from my `application.properties` file. In fact below codes do that. But I think there is a good method for this alternative. ``` Prop...

6 Aug at 09:28

Jenkins CI Pipeline Scripts not permitted to use method groovy.lang.GroovyObject

I am Using Jenkins 2 for compiling Java Projects, I want to read the version from a pom.xml, I was following this example: [https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md](https...