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 HelloWorldFubuRegistry : FubuRegistry | |
{ | |
public HelloWorldFubuRegistry() | |
{ | |
IncludeDiagnostics(true); | |
HomeIs<HomeInputModel>(); | |
Actions | |
.IncludeClassesSuffixedWithController(); |
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
FubuApplication | |
.For<HelloWorldFubuRegistry>() | |
.StructureMap(() => new Container()) | |
.Bootstrap(RouteTable.Routes); |
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
//This feels filthy. Need to make sure we don't overwrite this, and it doesn't get executed when we don't | |
//want it to, and ... the airbag blows up in my face. Need to clean it up after we are sure this is what | |
//we want. |
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
// Extension method in FubuCore | |
public static T CloseAndBuildAs<T>(this Type openType, params Type[] parameterTypes) | |
{ | |
var closedType = openType.MakeGenericType(parameterTypes); | |
return (T) Activator.CreateInstance(closedType); | |
} | |
// Ahem, uncompleted spike somewhere in FubuMVC I need to strip out or finish... |
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 MyFubuRegistry : FubuRegistry | |
{ | |
public MyFubuRegistry() | |
{ | |
HtmlConvention<PasswordConvention>(); | |
} | |
} | |
public class PasswordConvention : HtmlConventionRegistry | |
{ |
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
try | |
{ | |
return true; | |
} | |
catch | |
{ | |
return false; | |
} |
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 ReaderWriterLockExtensions | |
{ | |
public static void Write(this ReaderWriterLockSlim rwLock, Action action) | |
{ | |
rwLock.EnterWriteLock(); | |
try | |
{ | |
action(); | |
} | |
finally |
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 ReaderWriterLockExtensions | |
{ | |
public static void Write(this ReaderWriterLockSlim rwLock, Action action) | |
{ | |
rwLock.EnterWriteLock(); | |
try | |
{ | |
action(); | |
} | |
finally |
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 BodyAction = Func< | |
Func< //next | |
ArraySegment<byte>, // data | |
Action, // continuation | |
bool>, // continuation was or will be invoked | |
Action<Exception>, //error | |
Action, //complete | |
Action>; //cancel | |
using BodyDelegate = System.Func<System.Func<System.ArraySegment<byte>, // data |
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 Wait | |
{ | |
public static void Until(Func<bool> condition, int millisecondPolling = 500, int timeoutInMilliseconds = 5000) | |
{ | |
if (condition()) return; | |
var reset = new ManualResetEvent(false); | |
ThreadPool.QueueUserWorkItem(o => | |
{ |
OlderNewer