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 abstract class StepBase<T,TProperty, TSelf> : IConfigurable<PropertyRule<T>, TSelf> where TSelf : StepBase<T, TProperty, TSelf> { | |
| ... | |
| } |
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
| @Html.Grid(Model).Columns(column => { | |
| column.Custom( | |
| @<div> | |
| <em>Hello there</em> | |
| <strong>@item.Name</strong> | |
| </div> | |
| ).Named("Custom Column"); | |
| }) |
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
| before_each { | |
| write-host "I will be written before each test is run" | |
| } | |
| when "True is true" { | |
| assert { $true -eq $true } | |
| } | |
| when "True is false, the world may explode" { | |
| assert { $true -eq $false } "True should be false" |
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 ActionResult Sorting(GridSortOptions sort) | |
| { | |
| // If there's no sort option specifed, then default to sorting on the Name column. | |
| if(string.IsNullOrEmpty(sort.Column)) { | |
| sort = new GridSortOptions { Column = "Name" }; | |
| } | |
| ViewData["sort"] = sort; |
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
| <%= Html.Grid(Model).Columns(column => { | |
| column.For(x => "<a href='" + Url.Action("Edit") + "'><img src='/content/images/edit.jpg' /></a>").Encode(false); | |
| }) %> |
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
| // Should allow for this syntax: | |
| // RuleFor(x => x.Surname).NotNull().WithLocalizedMessage(() => MyResources.SomeResource, x => "foo", x => "bar"); | |
| // ...where MyResources.SomeResource has format placeholders | |
| public static IRuleBuilderOptions<T, TProperty> WithLocalizedMessage<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, Expression<Func<string>> resourceSelector, params Func<T, object>[] funcs) { | |
| return rule.Configure(config => { | |
| config.CurrentValidator.ErrorMessageSource = LocalizedStringSource.CreateFromExpression(resourceSelector, new StaticResourceAccessorBuilder()); | |
| funcs | |
| .Select(func => new Func<object, object>(x => func((T)x))) |
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 PeopleGridModel : GridModel<Person> { | |
| public PeopleGridModel(HtmlHelper html) { | |
| Column.For(x => html.ActionLink("View Details", "Show", new{id = x.Id})); | |
| } | |
| } | |
| <%= Html.Grid(Model).WithModel(new PeopleGridModel(Html)) %> |
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
| //MyScript.cs | |
| public class MyScript : Phantom.Core.BuildScript { | |
| Target @default =() => { | |
| System.Console.WriteLine("foo"); | |
| }; | |
| } | |
| phantom.exe -f:path/to/MyScript.cs | |
| // runs the "default" target from myscript.cs |
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 ICommandHandler<TCommand> { | |
| void Handle(TCommand command); | |
| } | |
| public interface IDispatcher { | |
| void Invoke<TCommand>(TCommand command); | |
| } | |
| public class Dispatcher : IDispatcher { | |
| public void Invoke<TCommand>(TCommand command) { |
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
| protected override bool RenderHeader() { | |
| base.RenderHeader(); | |
| return !IsDataSourceEmpty(); | |
| } | |
| protected override bool ShouldRenderHeader() { | |
| return true; | |
| } |