This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using System.Web; | |
using System.Web.Http; | |
using System.Web.Http.Controllers; | |
namespace Miscellaneous.Attributes.Controller | |
{ | |
/// <summary> | |
/// Filter by IP address (ASP.NET Web API version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
var config = GlobalConfiguration.Configuration; | |
// Replace the default JsonFormatter with our custom one | |
var index = config.Formatters.IndexOf(config.Formatters.JsonFormatter); | |
config.Formatters[index] = new JsonCamelCaseFormatter(); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BooksApiController : FooApiController | |
{ | |
public IEnumerable<Book> Get() | |
{ | |
return DocumentSession | |
.Query<Book>() | |
.OrderByAscending(p => p.Author) | |
.Take(100); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IRavenUniqueInserter | |
{ | |
void StoreUnique<T, TUnique>( | |
IDocumentSession session, T entity, | |
Expression<Func<T, TUnique>> keyProperty); | |
} | |
public class RavenUniqueInserter : IRavenUniqueInserter | |
{ | |
public void StoreUnique<T, TUnique>(IDocumentSession session, T entity, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem Warning: this batch file deletes ALL Raven DB data and databases, leaving you with a totally empty (but ready to use) Raven DB instance. | |
net stop RavenDB | |
rd /S /Q C:\RavenDB\Server\Data | |
rd /S /Q C:\RavenDB\Server\Tenants | |
net start RavenDB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ReSharper disable CheckNamespace | |
namespace RestSharp.Deserializers | |
// ReSharper restore CheckNamespace | |
{ | |
public class DynamicJsonDeserializer : IDeserializer | |
{ | |
public string RootElement { get; set; } | |
public string Namespace { get; set; } | |
public string DateFormat { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.Practices.Prism.Events; | |
// ReSharper disable CheckNamespace | |
namespace Microsoft.Practices.Prism.Events | |
// ReSharper restore CheckNamespace | |
{ | |
public static class CompositePresentationEventExtensions | |
{ | |
public static IObservable<TEventArgs> AsObservable<TEventArgs>(this CompositePresentationEvent<TEventArgs> @event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class FindStaticCtors | |
{ | |
[Test] | |
public void Foo() | |
{ | |
var typesWithCctors = new[] | |
{ | |
Assembly.GetAssembly(typeof(xyz)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reflection; | |
using Devart.Data.Oracle; | |
void PrintDevartOracleHome() | |
{ | |
// SUPER HACKY | |
// Get internal property OracleHomeCollection.SingletonInstance | |
var homes = (OracleHomeCollection)typeof(OracleHomeCollection) | |
.GetProperties(BindingFlags.Static | BindingFlags.NonPublic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
// see http://stackoverflow.com/questions/3975741/column-headers-in-csv-using-filehelpers-library/8258420#8258420 | |
// ReSharper disable CheckNamespace | |
namespace FileHelpers | |
// ReSharper restore CheckNamespace |