Skip to content

Instantly share code, notes, and snippets.

@alfeg
alfeg / GenericHelpers.cs
Created October 13, 2011 11:02
Html helper for script jquery templates
public static class GenericHelpers
{
public static HtmlTemplate HtmlTemplate(this HtmlHelper html, object htmlAttributes)
{
return new HtmlTemplate(html, htmlAttributes);
}
}
/*db.Blogs
.Include("Posts")
.Include("Posts.Comments")
.Where(x => x.Id == 1)
.ToList();*/
SELECT [Project2].[Id] AS [Id],
// Basic interfaces
/// <summary>
/// Wrapper of repository acces
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IDataRepository<T> where T : class
{
/// <summary>
@alfeg
alfeg / gist:878596
Created March 20, 2011 19:37
Topshelf configurator example
RunConfiguration cfg = RunnerConfigurator.New(
x =>
{
x.ConfigureService<SomeClass>(c =>
{
c.WhenStarted(s => s.BootHost());
c.WhenStopped(s => s.ShutDownHost());
c.WhenPaused(s => s.ShutDownHost());
c.WhenContinued(s => s.BootHost());
c.HowToBuildService(
class A
{
private object _locker = new object();
public event EventHandler Bang;
public void Foo()
{
new Thread(() =>
{