View current sql queries on MSSQL database

To view current sql queries running on sql database you can use this sql script to get current query and elapsed time. SELECT sqltext.TEXT, req.session_id, req.status, req.command, req.cpu_time, req.total_elapsed_time FROM sys.dm_exec_requests req CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext I have only…

Abstract InjectionMemberElement object cannot be created

Case: Azure webapp. Solution with multiple projects that uses unity. Working fine on localhost but not when published, getting the message: “An error occurred creating the configuration section handler for unity: An abstract InjectionMemberElement object cannot be created. Please specify…

Entity type is not part of the model for current context

The entity type <Type> is not part of the model for the current context. ExceptionType: System.InvalidOperationException System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) vid System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() vid System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext() — Slut på stackspårningen från föregående plats där ett undantag utlöstes — vid System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)…

Linq select many from list and keep id

This example applies to if you want to select the id from class A and all flatten list elements from “ListB”: public class A { int Id {get; set;} List ListB {get; set;} } var _listItems = (from x in…

Local IIS failed to map the path ‘/’

Got an exception of System.InvalidOperationException: “Failed to map the path ‘/’” when starting the site on a local IIS. System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException) +556 [HttpException (0x80004005): Det gick inte att mappa sökvägen /.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)…

Windows shortcut show desktop

In order to create a shortcut that shows the desktop you can create a shortcut in the quick launch section. Here is how: 1. Open the quick launch folder. 2. Create a new text file. 3. Copy and paste the…

File not found & dexDebug failed

Had some problem to build a Cordova app in VS. Tried updating java, Android SDK etc..but still same problem (java.lang file not found and dexDebug failed). Finally I found out that you can’t have a Cordova project inside a path…

Virtual event – Connect 2015

Interesting upcoming virtual event “Connect 2015” @ nov 18’th by Microsoft. Microsoft Connect 2015 Look most forward for the subject at day 2 “Building apps with .NET – ASP.NET & .NET Core”.

Call stored procedure via DBContext

Tried to call a SP via Entity framework (DBContext) but got a exception that parameter is not supplied. My call looked like: context.Database.ExecuteSqlCommand(“NameOfSP”, new SqlParameter(“@param1”, 1), new SqlParameter(“@param2”, DateTime.Now), new SqlParameter(“@param3”, “test”)); The right call should look like: context.Database.ExecuteSqlCommand(“NameOfSP @p1,…

Font in Windows 10 (Chrome)

I’ve upgraded to Windows 10 for about a month ago. After the update the Arial font seems really strange in some Windows forms and browsers. I.e in Chrome it looks like this:   This problem isn’t existing in Firefox so…

Background image opacity with hover CSS

Create a menu option with background image with only css. On hover change opacity for the background image. Without affecting the text color. .mainMenu .option { width: 374px; height: 248px; display: inline-block; border: 1px solid #d0d0d0; vertical-align: top; margin: 2px…