Dev How-To Archive

These are how-to articles from my days as an asp.net coder. They were things that I wanted to document but mostly couldn’t easily find other resources for. Now that I have moved into dev management, these topics will be old and mostly obsolete. However, I keep them here to accommodate links elsewhere on the web.

What we can all learn from Stack Overflow’s security incident

Stack Overflow had a security breach, and they have generously shared the details of how a hacker worked through multiple layers of security over 11 days. They gained access to source code, security keys, build processes, and some PII. Reading their account (at https://stackoverflow.blog/2021/01/25/a-deeper-dive-into-our-may-2019-security-incident) really brought home an important lesson… small issues in overlapping layers … Continue reading What we can all learn from Stack Overflow’s security incident

How to Set a Default Value on a Configurable Variable in a SQL Server Stored Procedure Using IsNull()

The Situation You have a SQL Server stored procedure that needs variable for use in a query, but you don’t want to pass it into the stored procedure as a parameter, and you don’t want to hard-code it. Instead you have the value stored in a table and want to retrieve it from there. There … Continue reading How to Set a Default Value on a Configurable Variable in a SQL Server Stored Procedure Using IsNull()

How To Extend the Timeout Period on an Entity Framework Query

The Situation: You have a long running Entity Framework query that often creates a “System.Data.SqlClient.SqlException” with the message “Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.” A Solution: As near as I can find, the default timeout for EF queries using the SQL Server 2008 … Continue reading How To Extend the Timeout Period on an Entity Framework Query

How To Process a Portion of a Form via Callback and Display a Results Message Using DevExpress Controls

The Situation: You have an ASP.NET page with multiple form sections, and you want to process only one section when an ASPxButton control is clicked. You also want to display a status message after processing. A Solution: This should be basic Ajax-type stuff, but as I am a self-taught programmer, I came to this late. … Continue reading How To Process a Portion of a Form via Callback and Display a Results Message Using DevExpress Controls

How to Add a New Table to an Existing Database via EF Code-First Migrations

The Situation: You have been using Entity Framework code-first migrations with an existing database. Making changes to an existing table, such as adding a new field, go smoothly, and the database is updated correctly when you run an “Update-database” command. However, when you create an entirely new entity in your model and run “Update-database”, the … Continue reading How to Add a New Table to an Existing Database via EF Code-First Migrations

How to Enable and Use EF Code-First Migrations for Multiple Contexts

The Situation You want to use Entity Frameworks code-first migrations to push model changes to the database, but you have multiple¬†databases and contexts in your model. When you try to run Enable-Migrations for the second context, you get an error that looks like this: Migrations have already been enabled in project ‘Project1’. To overwrite the … Continue reading How to Enable and Use EF Code-First Migrations for Multiple Contexts


Follow My Blog

Get new content delivered directly to your inbox.