1/6/15

Add Data Annotations to Entity Framework Models with Metadata or Buddy Classes

When using code generation (ORM), the model classes are automatically created by the tools.  We usually try to edit the class and add annotations such as field requirements, formatting and messages. The problem with this approach is that when we need to add properties to the model class, we will...

10/31/14

SQL Server Parse HTML Content from Data

With this TSQL script, we can remove HTML content as long as there are valid start and ending HTML tags. Script: Create FUNCTION [dbo].[udf_StripHTMLContent] (@content VARCHAR(MAX),@tagStart varchar(55),  @tagEnd varchar(55)) RETURNS VARCHAR(MAX) AS BEGIN DECLARE @start INT=1 DECLARE @end INT=1 DECLARE @len INT=1            ...

9/14/14

Recover a SQL Server management studio query

We often come across the case when SSMS crashes and perhaps your query was not saved. If you have the AutoSave feature enabled, you can find a temporary file at this location: c:\users\{username}\SQL Server Management Studio\Backup Files\Solution1 If you do not have this feature, you can still recover the script to the state when it was last executed by reading the information from the dynamic...

9/13/14

Client Side HTML Semantic Templates with Handlebars.js

When working with ASP.NET MVC Web applications, a common approach is to create the user interface by defining server side views and binding the model/data to these views. Basically the HTML gets generated on the server. What if we would just like to download the data and templates to reduce the HTML...