XorEdge.Database 1.0.2

Database Context with default EntityBase and BeforeSave / AfterSave hooks

Install-Package XorEdge.Database -Version 1.0.2
dotnet add package XorEdge.Database --version 1.0.2
<PackageReference Include="XorEdge.Database" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XorEdge.Database --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

public class DbContext : XorEdgeDbContext
{
public DbContext() : base("DefaultConnection") { }

    public DbSet<Customer> Customers { get; set; }
}

public class Customer : EntityBase
{
    public int Id { get; set; }
    public string Name { get; set; }

    public string Tag1 { get; set; }
    public string Tag2 { get; set; }

    public override void BeforeSave(XorEdgeDbContext db, EntityState state)
    {
        this.Tag1 = "Before save";

        base.BeforeSave(db, state);
    }

    public override void AfterSave(XorEdgeDbContext db, EntityState state)
    {
        this.Tag2 = "After save";

        base.AfterSave(db, state);
    }
}

public class DbContext : XorEdgeDbContext
{
public DbContext() : base("DefaultConnection") { }

    public DbSet<Customer> Customers { get; set; }
}

public class Customer : EntityBase
{
    public int Id { get; set; }
    public string Name { get; set; }

    public string Tag1 { get; set; }
    public string Tag2 { get; set; }

    public override void BeforeSave(XorEdgeDbContext db, EntityState state)
    {
        this.Tag1 = "Before save";

        base.BeforeSave(db, state);
    }

    public override void AfterSave(XorEdgeDbContext db, EntityState state)
    {
        this.Tag2 = "After save";

        base.AfterSave(db, state);
    }
}

Release Notes

Removed Id from EntityBase

Version History

Version Downloads Last updated
1.0.2 230 2/15/2018
1.0.1 208 2/15/2018
1.0.0 184 12/29/2017