Skip to content

Instantly share code, notes, and snippets.

Wullems Bart wullemsb

Block or report user

Report or block wullemsb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View IAsyncLifetime.cs
namespace Xunit
{
/// <summary>
/// Used to provide asynchronous lifetime functionality. Currently supported:
/// - Test classes
/// - Classes used in <see cref="IClassFixture{TFixture}"/>
/// - Classes used in <see cref="ICollectionFixture{TFixture}"/>.
/// </summary>
public interface IAsyncLifetime
{
View ConfigureGrainStorageXML.cs
var siloHostBuilder = new SiloHostBuilder()
.AddAdoNetGrainStorage("OrleansStorage", options=>
{
options.Invariant = "<Invariant>";
options.ConnectionString = "<ConnectionString>";
options.UseXmlFormat = true;
});
View ConfigureGrainStorage.cs
var siloHostBuilder = new SiloHostBuilder()
.AddAdoNetGrainStorage("OrleansStorage", options=>
{
options.Invariant = "<Invariant>";
options.ConnectionString = "<ConnectionString>";
options.UseJsonFormat = true;
});
View RuleFor.cs
RuleFor(m => m.ToAddresses).NotEmpty().WithMessage("You need to set at least one to address");
View SetCollectionValidator.cs
RuleFor(m => m.ToAddresses).SetCollectionValidator(new MailAddressValidator());
View RuleForEach.cs
RuleForEach(m => m.ToAddresses).SetValidator(new MailAddressValidator());
View DbQuery.cs
public class SampleContext: DbContext
{
public SampleContext(DbContextOptions<SampleContext> options)
: base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.Query<BlogDTO>();
View FromSql.cs
var blogs = db.BlogDTOs.FromSql(@"select b.Name, b.Url from Blogs b");
View ModelBuilderToQuery.cs
public class SampleContext: DbContext
{
public SampleContext(DbContextOptions<SampleContext> options)
: base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.Query<BlogDTO>().ToQuery(Blogs.Select(b => new BlogDTO { Name, Url });
View ModelBuilderToView.cs
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.Query<BlogDTO>().ToView("vwBlogs");
}
You can’t perform that action at this time.