This file contains hidden or 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 ApplicationSetting : ISiteContextualEntity | |
{ | |
public string Key { get; set; } | |
public string Value { get; set; } | |
public int SiteId { get; set; } | |
public Site Site { get; set; } | |
} |
This file contains hidden or 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 virtual IQueryable<T> Query(ISpecification<T> query) | |
{ | |
var specifications = new List<ISpecification<T>>(); | |
_specificationPolicies | |
.Where(p => p.Applies<T>()) | |
.Select(p => p.Build<T>()) | |
.Each(specifications.Add); | |
_entityPolicies |
This file contains hidden or 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 ISpecification<T> | |
{ | |
Expression<Func<T, bool>> IsSatisfied(); | |
} |
This file contains hidden or 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 RequiresAuthenticationConvention : IConfigurationAction | |
{ | |
public void Configure(BehaviorGraph graph) | |
{ | |
graph | |
.Actions() | |
.Where(action => action.HasInput && !action.InputType().HasAttribute<AllowUnauthenticatedAccessAttribute>()) | |
.Each(call => | |
{ | |
var log = graph.Observer; |
This file contains hidden or 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
// TODO -- come back and clean this up. Just getting it up and running for a demo | |
BehaviorDetailsModel root = null; | |
var behaviors = new Cache<Type, BehaviorDetailsModel>(t => | |
{ | |
var model = new BehaviorDetailsModel {BehaviorType = t}; | |
if(root == null) | |
{ | |
root = model; | |
} |
This file contains hidden or 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 IPartialDecorator<T> | |
where T : class | |
{ | |
T Enrich(T target); | |
} |
This file contains hidden or 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 void Invoke() | |
{ | |
if (performInvoke() == DoNext.Continue && InsideBehavior != null) | |
{ | |
InsideBehavior.Invoke(); | |
} | |
afterInsideBehavior(); | |
} |
This file contains hidden or 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 IValidationQuery | |
{ | |
IEnumerable<IValidationRule> RulesFor(object target); | |
IEnumerable<IValidationRule> RulesFor(Type targetType); | |
T GetRule<T>(Accessor accessor) where T : class, IValidationRule; | |
T GetStrategy<T>(Accessor accessor) where T : class, IFieldValidationStrategy; | |
void ForRule<T>(Accessor accessor, Action<T, Accessor> action) where T : class, IValidationRule; | |
void ForStrategy<T>(Accessor accessor, Action<T, Accessor> action) where T : class, IFieldValidationStrategy; | |
bool HasRule<T>(Accessor accessor) where T : class, IValidationRule; | |
bool HasStrategy<T>(Accessor accessor) where T : class, IFieldValidationStrategy; |
This file contains hidden or 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
[Test] | |
public void should_return_single_view_token_matched_on_policy_criteria() | |
{ | |
_descriptor.Templates.Add("Projects\\Dashboard.spark"); | |
_descriptor.Templates.Add("Shared\\Application.spark"); | |
var descriptor2 = newDescriptor(); | |
descriptor2.Templates.Add("Projects\\StoryMap.spark"); | |
descriptor2.Templates.Add("Shared\\Application.spark"); | |
_token.Descriptors.Add(descriptor2); |
This file contains hidden or 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 OrderProcessingModule | |
{ | |
public void Process(OrderStatusMessage orderStatusMessage) | |
{ | |
string connectionString = ConfigurationManager.ConnectionStrings["Main"].ConnectionString; | |
Order order = null; | |
using(var connection = new SqlConnection(connectionString)) | |
{ | |
order = FetchData(orderStatusMessage, connection); |