Skip to content

Instantly share code, notes, and snippets.

View alexeyzimarev's full-sized avatar
🎖️
Protecting common sense

Alexey Zimarev alexeyzimarev

🎖️
Protecting common sense
View GitHub Profile
@alexeyzimarev
alexeyzimarev / AutofacDependencyResolver.cs
Last active May 31, 2016 16:09
Autofac version of ReactiveUI IMutableDependencyResolver
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Autofac;
using Autofac.Core;
namespace ReactiveUI
{
public class AutofacDependencyResolver : IMutableDependencyResolver
@alexeyzimarev
alexeyzimarev / gist:9930005
Created April 2, 2014 08:14
Initialize AutofacDependencyResolver for ReactiveUI sample
// this is your bootstrapper
var builder = new ContainerBuilder();
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).AsImplementedInterfaces();
// some other registrations here
var container = builder.Build();
RxAppAutofacExtension.UseAutofacDependencyResolver(container);
namespace crap
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
public class PartialAppPlayground
<!DOCTYPE html>
<head>
<title>HTML5 Camera Fun</title>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://www.nihilogic.dk/labs/exif/exif.js" type="text/javascript"></script>
<script src="http://www.nihilogic.dk/labs/binaryajax/binaryajax.js" type="text/javascript"></script>
<script type="text/javascript">
// Wrapper around MPL-licensed http://www.nihilogic.dk/labs/binaryajax/binaryajax.js
// to support JavaScript typed arrays since binary strings are not supported in IE 10
var createBinaryFile = function(uintArray) {
@alexeyzimarev
alexeyzimarev / NHibernateSqlProcedureHelper.cs
Created December 12, 2014 10:21
Execute stored procedure and get return value, using NHibernate session
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using NHibernate;
namespace NHibernate.Helpers
{
public static class SqlProcedureHelper
{
public class GetEventStoreEventDispatcher
{
private readonly IEventBus _eventBus;
private readonly EventStoreConnection _connection;
private bool _stopRequested;
private EventStoreAllCatchUpSubscription _subscription;
private readonly IPersistGetEventStorePosition _positionRepository;
public GetEventStoreEventDispatcher(EventStoreConnection connection, IEventBus eventBus, IPersistGetEventStorePosition positionRepository)
public class AutofacIocAdapter : IContainerAdapter
{
private readonly IContainer _container;
public AutofacIocAdapter(IContainer container)
{
_container = container;
}
private ILifetimeScope CurrentScope
public class Global : HttpApplication
{
private static AppHost _appHost;
protected void Application_Start(object sender, EventArgs e)
{
_appHost = new AppHost();
_appHost.Init();
}
using System.Reflection;
using Autofac;
using Autofac.Core.Lifetime;
using Funq;
using Serilog;
using ServiceStack.Api.Postman;
using ServiceStack.Api.Swagger;
using ServiceStack.Logging;
using ServiceStack.Logging.Serilog;
using ServiceStack.ServiceInterface.Cors;
using System;
using Autofac;
using Funq;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Web;
using ServiceStack.ServiceInterface;
using ServiceStack.Common;
using ServiceStack.ServiceInterface.Admin;