Skip to content

Instantly share code, notes, and snippets.

@valeriob
valeriob / RxAsync.cs
Created December 8, 2019 14:23
RxExtensions Observable.FromAsync
using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
namespace ConsoleApp5
{
class Program
{
static void Main(string[] args)
<h2>Index</h2>
<div>
Test Url DI :@Url.Action(MVCTest.Dummy)
</div>
@valeriob
valeriob / RavenDb_IndexCreation_CreateIndexes.cs
Created September 18, 2015 12:09
RavenDB-3785 Creating indexes by IndexCreation.CreateIndexes does not honor store.Conventions.FindTypeTagName
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Indexes;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Raven.Client.Document;
using Raven.Client.Indexes;
using System;
using System.Linq;
namespace RavenDbTryout.DefaultIfEmpty
{
public class IndexDefaultIfEmpty
{
public void Run()
{
@valeriob
valeriob / gist:a81fc839671df23cb88b
Last active August 29, 2015 14:13
RavenDb Contextual Listener
// The same principle can be applyed to pass Container scope to the Listener and extract events published by entities via change tracking.
// Has the nice addition to audit messages and can enable async dispatching
// register documentstore on container
cb.Register<IDocumentSession>(r =>
{
var s = r.Resolve<IDocumentStore>().OpenSession(database);
s.Advanced.ExternalState["ILifetimeScope"] = r.Resolve<ILifetimeScope>();
@valeriob
valeriob / TypeLite.Net4.tt
Created December 27, 2014 08:42
TypeLite.Net4.tt (1.0.1.0) Knockout support
<#@ template debug="false" hostspecific="True" language="C#" #>
<#@ assembly name="$(TargetDir)TypeLite.dll" #>
<#@ assembly name="$(TargetDir)TypeLite.Net4.dll" #>
<#@ assembly name="$(TargetDir)$(TargetFileName)" #>
<#@ import namespace="TypeLite" #>
<#@ import namespace="TypeLite.Net4" #>
<#@ import namespace="TypeLite.TsModels" #>
<#@output extension=".d.ts"#>
@valeriob
valeriob / OrmLite_Extensions
Created November 17, 2012 01:01
OrmLite Insert Update extensions
public static class OrmLite_Extensions
{
public static void Insert2<T>(this IDbConnection dbConn, params T[] objs)
where T : new()
{
foreach (var obj in objs)
dbConn.Exec(dbCmd => OrmLiteConfig.DialectProvider.CreateParameterizedInsertStatement(obj, dbConn).ExecuteNonQuery() );
}
public static void Update2<T>(this IDbConnection dbConn, params T[] objs)