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
| var customer = new Customer(); | |
| customer.Firstname = "Ad"; | |
| customer.Lastname = "van der Kaart"; | |
| var order1 = new Order(); | |
| order1.ProductId = 3; | |
| order1.Quantity = 10; | |
| customer.Orders.Add(order1); | |
| var order2 = new Order(); | |
| order2.ProductId = 7; | |
| order2.Quantity = 5; |
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
| var customer = new Customer(); | |
| customer.Firstname = "Ad"; | |
| customer.Lastname = "van der Kaart"; | |
| var order1 = new Order(); | |
| order1.ProductId = 3; | |
| order1.Quantity = 10; | |
| customer.Orders.Add(order1); | |
| var order2 = new Order(); | |
| order2.ProductId = 7; | |
| order2.Quantity = 5; |
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("basic") | |
| .setCaption("Basic Grid") | |
| .addColumn(new Column("CustomerId") | |
| .setLabel("Id")) | |
| .addColumn(new Column("Name")) | |
| .addColumn(new Column("Company")) | |
| .addColumn(new Column("EmailAddress")) | |
| .addColumn(new Column("Last Modified")) | |
| .addColumn(new Column("Telephone")) | |
| .setUrl("/Home/GridDataBasic/") |
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
| var pocoFactory = AutoPocoContainer.Configure(x => | |
| { | |
| x.Conventions(c => c.UseDefaultConventions()); | |
| x.AddFromAssemblyContainingType<User>(); | |
| x.Include<User>() | |
| .Setup(u => u.Email).Use<EmailAddressSource>() | |
| .Setup(u => u.Firstname).Use<FirstNameSource>() | |
| .Setup(u => u.Lastname).Use<LastNameSource>() | |
| .Setup(u => u.DateOfBirth).Use<DateOfBirthSource>() | |
| .Setup(u => u.Company).Use<CompanySource>(); |
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 CompanySource : DatasourceBase<String> | |
| { | |
| private readonly Random _random = new Random(1337); | |
| public override string Next(IGenerationContext context) | |
| { | |
| return Companies[_random.Next(0, Companies.Length)]; | |
| } | |
| private static readonly string[] Companies = new[]{ |
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 ExampleSource : DatasourceBase<string> | |
| { | |
| public override string Next(IGenerationContext context) | |
| { | |
| throw new NotImplementedException(); | |
| } | |
| } |
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
| // Create factory for poco's and setup datasources | |
| var pocoFactory = AutoPocoContainer.Configure(x => | |
| { | |
| x.Conventions(c => c.UseDefaultConventions()); | |
| x.AddFromAssemblyContainingType<User>(); | |
| x.Include<User>() | |
| .Setup(u => u.Email).Use<EmailAddressSource>() | |
| .Setup(u => u.Firstname).Use<FirstNameSource>() | |
| .Setup(u => u.Lastname).Use<LastNameSource>() | |
| .Setup(u => u.DateOfBirth).Use<DateOfBirthSource>(); |
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 User | |
| { | |
| public int Id { get; set; } | |
| public string Firstname { get; set; } | |
| public string Lastname { get; set; } | |
| public string Email { get; set; } | |
| public DateTime DateOfBirth { 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
| AssemblyScanner.FindValidatorsInAssembly( Assembly.GetExecutingAssembly()) | |
| .ForEach(match => kernel.Bind(match.InterfaceType).To(match.ValidatorType)); |
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
| NinjectValidatorFactory ninjectValidatorFactory = new NinjectValidatorFactory(Kernel); | |
| FluentValidationModelValidatorProvider | |
| .Configure(x => x.ValidatorFactory = ninjectValidatorFactory); | |
| DataAnnotationsModelValidatorProvider | |
| .AddImplicitRequiredAttributeForValueTypes = false; |