Skip to content

Instantly share code, notes, and snippets.

Amit Choudhary vendettamit

Block or report user

Report or block vendettamit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
vendettamit /
Created May 2, 2016
A T4Template to auto generate Unit of work factory over repository pattern (Entity framework)
<#@ template debug="true" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Core.dll" #>
<#@ Assembly Name="System.Xml.dll" #>
<#@ Assembly Name="System.Xml.Linq.dll" #>
<#@ Assembly Name="System.Windows.Forms.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
vendettamit / IdentitySeed.sql
Created Apr 5, 2016
Demo scripts replicating the scenario where Trunc would reset the Reseeded identity column in existing table
View IdentitySeed.sql
USE [YourDb]
-- Create Table
CREATE TABLE [dbo].[TestTable](
[ID] [int] IDENTITY(11,1) NOT NULL,
[Var] [nchar](10) NULL,
[Dated] DateTime default CURRENT_TIMESTAMP
vendettamit / Trigger.js
Last active Feb 23, 2016
Change default onfocusout and trigger validation for individual form elements while user starts typing in input fields
View Trigger.js
$(document).ready(function () {
var $validatr = $('form').data('validator');
var settngs = $validatr.settings;
settngs.onkeyup = function (element, eventType) {
if (!$validatr.element(element))
$(this.currentForm).triggerHandler("invalid-form", [this]);
vendettamit / DynamicLinqCSharp.cs
Created Feb 19, 2016
A dynamic linq class library source code. Download the original content from here -
View DynamicLinqCSharp.cs
//Copyright (C) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
vendettamit / TfvcTemplate.12.WithChaining.xaml
Created Feb 18, 2016 — forked from jstangroome/TfvcTemplate.12.WithChaining.xaml
The Team Build 2013 default process template for TFVC with support for queuing additional builds on success and passing parameters.
View TfvcTemplate.12.WithChaining.xaml
<Activity x:Class="TfsBuild.Process" xmlns="" xmlns:mc="" xmlns:mt="clr-namespace:Microsoft.TeamFoundation;assembly=Microsoft.TeamFoundation.Common" xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client" xmlns:mtbco="clr-namespace:Microsoft.TeamFoundation.Build.Common;assembly=Microsoft.TeamFoundation.Build.Common" xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtba="clr-namespace:Microsoft.TeamFoundation.Build.Activities;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbac="clr-namespace:Microsoft.TeamFoundation.Build.Activities.Core;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbag="clr-namespace:Microsoft.TeamFound
View ExpensiveSqlLoggerInterceptor.cs
public class ExpensiveSqlLoggerInterceptor : DbCommandInterceptor
private readonly IQueryLogger _queryLogger;
private readonly int _executionMillisecondThreshold;
private readonly bool _includeStackTrace;
public ExpensiveSqlLoggerInterceptor(IQueryLogger logger, int executionMillisecondThreshold, bool enableStackTrace = true)
_queryLogger = logger;
_executionMillisecondThreshold = executionMillisecondThreshold;
View GroupByPOC.cs
public class Program
class TeamHistory
public DateTime Date { get; set; }
public string Event { get; set; }
public string TeamName { get; set; }
vendettamit / LinqVisualizerForIGrouping.cs
Created Feb 12, 2016
A snippet to print nested IGrouping items from a GroupBy Linq.
View LinqVisualizerForIGrouping.cs
public static class LinqVisualizer
public static void Dump<Tkey, Telement>(this IEnumerable<IGrouping<Tkey, Telement>> source)
foreach (var item in source)
Console.WriteLine("Root Level Key : {0}", item.Key);
foreach (var group in item)
View MakePredicate.cs
var context = new ConferenceDb();
var query = context.Set<Conference>().AsNoTracking();
var predicate = ExpressionBuilder.MakePredicate<Conference>(new List<ExpressionModel>(new[] {
new ExpressionModel() {
Operator = ExpressionBuilder.ExpressionOperators.Equals,
PropertyName = "Slug",
Value = "Test"
new ExpressionModel() {
vendettamit / DynamicExpression.cs
Created Feb 11, 2016
Build a expression dynamically with the Type that only be known at runtimes.
View DynamicExpression.cs
public static class QueryableExtension
public static dynamic Build<Tobject>(this Tobject source, string propertyName)
var propInfo = typeof(Tobject).GetProperty(propertyName);
var parameter = Expression.Parameter(typeof(Tobject), "x");
var property = Expression.Property(parameter, propInfo);
You can’t perform that action at this time.