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 CompoundInterceptor FindInterceptor(Type type) | |
{ | |
CompoundInterceptor interceptor; | |
if (!_analyzedInterceptors.TryGetValue(type, out interceptor)) | |
{ | |
lock (_locker) | |
{ | |
if (!_analyzedInterceptors.TryGetValue(type, out interceptor)) | |
{ | |
TypeInterceptor[] interceptorArray = _interceptors.FindAll(i => i.MatchesType(type)).ToArray(); |
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
<viewdata model="FubuMVC.HelloSpark.Controllers.EarthViewModel" /> | |
<content:title>Down to Earth!</content:title> | |
<content:header>Where are we now?</content:header> | |
<h2>Via Spark Partial: <WhereAreWe /></h2> | |
<h2>Via Fubu Partial: | |
#this.Partial<LocationViewModel>(); | |
#this.Partial<LocationViewModel>(); | |
</h2> |
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 class Memoization | |
{ | |
public static Func<TA, TR> Memoize<TA, TR>(Func<TA, TR> f) | |
{ | |
var map = new Dictionary<TA, TR>(); | |
return a => | |
{ | |
lock (map) | |
{ |
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
// In a StructureMap registry somewhere (for us, it's in CoreRegistry.cs) | |
For<IObjectConverter>().Use<DovetailObjectConverter>(); | |
// In another file, we set up some of our conversions and conversion families | |
public class DovetailObjectConverter : ServiceEnabledObjectConverter | |
{ | |
public DovetailObjectConverter(IServiceLocator locator) | |
: base(locator) | |
{ |
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 EntityModelBinder : IModelBinder | |
{ | |
private static readonly TypeConverter _converter = TypeDescriptor.GetConverter(typeof (Guid)); | |
public bool Matches(Type type) | |
{ | |
return type.CanBeCastTo<DomainEntity>(); | |
} |
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.Collections.Generic; | |
using System.Linq; | |
using Spark; | |
using Spark.Compiler; | |
using Spark.Web.FubuMVC; | |
using Spark.Web.FubuMVC.ViewCreation; | |
using Spark.Web.FubuMVC.ViewLocation; | |
namespace ZG.Mvc.Theming.Views.Spark | |
{ |
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 SparkFinder | |
{ | |
private readonly SparkItems _items; | |
private readonly string[] _sharedFolderNames; | |
public SparkFinder(SparkItems items, string[] sharedFolderNames) | |
{ | |
_items = items; | |
_sharedFolderNames = sharedFolderNames; | |
} |
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 Func<Stream> Execute() | |
{ | |
var writer = new StringWriter(); | |
var view = (SparkViewBase)_provider.GetView(); | |
_partialOutput.SetWriter(() => view.Output); | |
view.Output = writer; | |
// something a la this: | |
return () => |
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 Func<TextWriter> Execute() | |
{ | |
var writer = new StringWriter(); | |
var view = (SparkViewBase)_provider.GetView(); | |
_partialOutput.SetWriter(() => view.Output); | |
view.Output = writer; | |
return () => | |
{ |
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
// Temporary : Needs discussion + test coverage (if used) | |
public class FubuBindingProvider : BindingProvider | |
{ | |
private readonly ISparkItems _sparkItems; | |
public FubuBindingProvider (ISparkItems sparkItems) | |
{ | |
_sparkItems = sparkItems; | |
} |
OlderNewer