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 ServiceResolverAdapter : IDependencyResolver | |
{ | |
private readonly System.Web.Mvc.IDependencyResolver dependencyResolver; | |
public ServiceResolverAdapter(System.Web.Mvc.IDependencyResolver dependencyResolver) | |
{ | |
if (dependencyResolver == null) throw new ArgumentNullException("dependencyResolver"); | |
this.dependencyResolver = dependencyResolver; | |
} |
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 Raven.Abstractions.Indexing; | |
using Raven.Client; | |
using Raven.Client.Document; | |
using Raven.Client.Indexes; | |
using Raven.Client.Linq; | |
namespace RavenDBProjectionTest |
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 static IList<TRes> ListAs<TRes>(this IQueryOver qry, TRes resultByExample) | |
{ | |
var ctor = typeof (TRes).GetConstructors().First(); | |
return qry.UnderlyingCriteria | |
.SetResultTransformer(Transformers.AliasToBeanConstructor(ctor)) | |
.List<TRes>(); | |
} | |
[Fact] | |
public void ListAs_Should_CastQueryOverResultToTypeSameAsSupliedExampleInstance() |
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 LinqToSqlRepository<TContext> | |
: IDisposable where TContext : DataContext, new() | |
{ | |
private readonly DataContext _dc; | |
public LinqToSqlRepository() | |
{ | |
_dc = new TContext(); | |
} |
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
private static readonly object GeneratorLock = new object(); | |
///<summary> | |
/// Create the next id (numeric) | |
///</summary> | |
private int NextAccountNumber() | |
{ | |
lock (GeneratorLock) | |
{ | |
using (new TransactionScope(TransactionScopeOption.Suppress)) |
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 IObjectContext : IDisposable | |
{ | |
ObjectContextOptions ContextOptions { get; } | |
TEntity CreateObject<TEntity>() where TEntity : class; | |
IObjectSet<TEntity> CreateObjectSet<TEntity>() where TEntity : class; | |
int SaveChanges(); | |
} |
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
class IncludeInterfacesModelMetadataProvider : DataAnnotationsModelMetadataProvider { | |
protected override IEnumerable<Attribute> FilterAttributes(Type containerType, PropertyDescriptor propertyDescriptor, IEnumerable<Attribute> attributes) { | |
var validationAttributesOnInterfaces = | |
from i in containerType.GetInterfaces() | |
from p in i.GetProperties() | |
where p.Name == propertyDescriptor.Name | |
from a in p.GetCustomAttributes(true).Cast<Attribute>() | |
where typeof(ValidationAttribute).IsAssignableFrom(a.GetType()) | |
select a; |
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
//create our "FOO" namespace | |
window.FOO = window.FOO || {}; | |
FOO.app1 = { | |
bar : 'foo', | |
init : function(){ | |
//this wont work as expected since timeout changes scope |
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 IHttpMessageSerializer | |
{ | |
void Serialize(HttpResponseMessage response, Stream stream); | |
void Serialize(HttpRequestMessage request, Stream stream); | |
HttpResponseMessage DeserializeToResponse(Stream stream); | |
HttpRequestMessage DeserializeToRequest(Stream stream); | |
} | |
public class MessageContentHttpMessageSerializer : IHttpMessageSerializer |
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
/* | |
* jQuery.ajaxQueue - A queue for ajax requests | |
* | |
* (c) 2011 Corey Frang | |
* Dual licensed under the MIT and GPL licenses. | |
* | |
* Requires jQuery 1.5+ | |
*/ | |
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).then(b,b).done(e.resolve).fail(e.reject)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery) |
OlderNewer