Skip to content

Instantly share code, notes, and snippets.

View glikoz's full-sized avatar

Oguz Karadenizli glikoz

View GitHub Profile
class Program
{
static void Main(string[] args)
{
var virtualBroker = new VirtualBroker();
var coolStrategy = new CoolStrategy();
var anotherCoolStrategy = new AnotherCoolStrategy();
var graph = RunnableGraph.FromGraph(GraphDsl.Create(b =>
{
var input = b.Add(Source.From(new[] { new TickData(11, 12), new TickData(12, 13) })); //FAIL- Must be dynamic Queue
class Program
{
static ActorSystem System;
static int loop = 1000;
static int maxParallel=100;//For Parallel Foreach
static int taskload = 50;
static void Main(string[] args)
{
[DependencyRegisterar(Lifetime = LifetimeManagers.PerRequest)]
public class RedisRepository : IRedisClientsManager, IBasicPersistenceProvider
{
#region Members
private const string CONFIGURATION_PREFIX = "cfg:";
private const string PERFORMANCE_PREFIX = "prf:";
private const string HASHSET_PREFIX = "set:";
private IRedisClientsManager _Manager;
/// <summary>
/// Represents a lifetime manager for request base life time management
/// </summary>
public class PerRequestLifetimeManager : LifetimeManager
{
#region Members
private LifetimeManager _WrappedLifetimeManager;
#endregion
/// <summary>
/// Represents a context class for db operations
/// </summary>
public class DbOperationContext : IDisposable
{
#region Members
private object syncRoot = new object();
private int _TransactionCount;
private Dictionary<Type, object> _TypedClients = new Dictionary<Type, object>();
@glikoz
glikoz / BaseController.cs
Created June 27, 2012 23:47
Base Controller for ServiceStack
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ServiceStack.Mvc;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceHost;
@glikoz
glikoz / UserAuthExtensions.cs
Created June 26, 2012 00:24
ServiceStack UserAuthExtensions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.Text;
namespace ServiceStack.ServiceInterface.Auth
{
public static class UserAuthExtensions
@glikoz
glikoz / threadinsert.cs
Created June 6, 2012 15:09
Threaded insert
private void ThreadedInsert(object obj)
{
RedisClient redis = new RedisClient(TestConfig.SingleHost);
Article a = new Article() { Name = "I Love Writing Test" };
a.Id = redis.As<Article>().GetNextSequence();
redis.Watch("idx:article:" + a.Name);
using (var trans = redis.CreateTransaction())
{
@glikoz
glikoz / gen.cs
Created June 1, 2012 02:16
Generic interface registration
container.Register <IRep<T>>(c => new Rep<T>())); /// Exception :)
container.RegisterAllTypesOf<IRep> (....)
@glikoz
glikoz / Test.cs
Created May 31, 2012 16:50
Usage of Container out of Controller
public class MyProvider
{
public IRepository MyRepository {get;set;}
public MyProvider()
{
// Registration made in AppHost as container.Register<IRepository>(c => new MyRepository ());
MyRepository= new Container().Resolve(IRepository); // a)Concrete Service Locator
MyRepository= Funq.Container.Resolve(IRepository); // b)Service Locator check this http://blog.ploeh.dk/2010/02/03/ServiceLocatorIsAnAntiPattern.aspx