Skip to content

Instantly share code, notes, and snippets.

@vendettamit
vendettamit / AppbootStrapper_CaliburnMicro_SimpleInjector.cs
Created September 10, 2015 23:20
A sample bootstrapper for Caliburn micro and SimpleInjector 3.0 migration changes.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Caliburn.Micro;
using SimpleInjector;
using System.Reflection;
using StackQuestionsClient.ViewModels;
using StackQuestionsClient.utilities;
@vendettamit
vendettamit / StringToValueTypeConverterTests.cs
Created September 11, 2015 15:54
A set of tests writter in NUnit to test a simple String to ValueType Converter.
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestForEverything.Converters;
namespace TestForEverything
{
@vendettamit
vendettamit / StringToValueTypeConverter.cs
Last active September 11, 2015 15:59
A simple string to valuetype converter using TypeDescriptor.
using System;
using System.ComponentModel;
namespace TestForEverything
{
/// <summary>
/// Extension methos of string providing conversions to primitve types
/// </summary>
public static class ConverterExtensions
{
@vendettamit
vendettamit / Roslyncompiler.cs
Created September 24, 2015 21:12
Run time compilation with Microsoft.CodeAnalysis(Roslyn) services
class Program
{
private static readonly IEnumerable<string> DefaultNamespaces =
new[]
{
"System",
"System.IO",
"System.Net",
"System.Linq",
"System.Text",
@vendettamit
vendettamit / ReferenceFinder.cs
Created October 7, 2015 21:06
This is a sample code that can be used to find references using Roslyn version Microsoft.CodeAnalysis 1.0.0
class ReferenceFinder
{
public void Find(string methodName)
{
string solutionPath = @"C:\Users\achoudhary\Documents\Visual Studio 2013\Projects\ConsoleForEverything\ConsoleForEverything.sln";
var msWorkspace = MSBuildWorkspace.Create();
List<ReferencedSymbol> referencesToMethod = new List<ReferencedSymbol>();
Console.WriteLine("Searching for method \"{0}\" reference in solution {1} ", methodName, Path.GetFileName(solutionPath));
@vendettamit
vendettamit / WebHttpBehaviorExtension.cs
Created October 8, 2015 22:44
The class contains a solution to use Types signature of methods in WebHttpBinding in WCF.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Web;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.Serialization.Json;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using System.Threading;
public static class HtmlHelperExtensions
{
private static readonly char Separator = '/';
private static readonly string TemplateFolder = HttpContext.Current.Server.MapPath("~/App/templates");
private static readonly IViewEngine ViewEngine = new HandlebarsRazorViewEngine();
public static MvcHtmlString RenderEmber(this HtmlHelper helper, string path = "", bool noTemplateName = false)
{
if (HttpRuntime.Cache[path] == null)
{
@vendettamit
vendettamit / gist:c883b72a150d435d6bed
Created December 28, 2015 19:21 — forked from SzymonPobiega/gist:5220595
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@vendettamit
vendettamit / FK_Reference_Finder.sql
Created December 29, 2015 22:07
Sql server script to get the FK relations for a particular table
declare @table as sysname
Set @table = 'Tranx_BirthChildCongenitalAnomaly'
SELECT
K_Table = FK.TABLE_NAME,
FK_Column = CU.COLUMN_NAME,
PK_Table = PK.TABLE_NAME,
PK_Column = PT.COLUMN_NAME,
Constraint_Name = C.CONSTRAINT_NAME
FROM