mirror of https://github.com/abpframework/abp.git
18 changed files with 153 additions and 385 deletions
@ -1,66 +0,0 @@ |
|||
// <auto-generated />
|
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage; |
|||
using Microsoft.EntityFrameworkCore.Storage.Internal; |
|||
using System; |
|||
using Volo.Abp.TestApp.Domain; |
|||
using Volo.Abp.TestApp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Tests.Migrations |
|||
{ |
|||
[DbContext(typeof(TestAppDbContext))] |
|||
[Migration("20170927080244_Initial_Migration")] |
|||
partial class Initial_Migration |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452"); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Person", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("Age"); |
|||
|
|||
b.Property<string>("Name"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("People"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Number"); |
|||
|
|||
b.Property<Guid>("PersonId"); |
|||
|
|||
b.Property<int>("Type"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("PersonId"); |
|||
|
|||
b.ToTable("AppPhones"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.TestApp.Domain.Person") |
|||
.WithMany("Phones") |
|||
.HasForeignKey("PersonId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -1,59 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using System; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Tests.Migrations |
|||
{ |
|||
public partial class Initial_Migration : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "People", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "BLOB", nullable: false), |
|||
Age = table.Column<int>(type: "INTEGER", nullable: false), |
|||
Name = table.Column<string>(type: "TEXT", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_People", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AppPhones", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<long>(type: "INTEGER", nullable: false) |
|||
.Annotation("Sqlite:Autoincrement", true), |
|||
Number = table.Column<string>(type: "TEXT", nullable: true), |
|||
PersonId = table.Column<Guid>(type: "BLOB", nullable: false), |
|||
Type = table.Column<int>(type: "INTEGER", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AppPhones", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AppPhones_People_PersonId", |
|||
column: x => x.PersonId, |
|||
principalTable: "People", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AppPhones_PersonId", |
|||
table: "AppPhones", |
|||
column: "PersonId"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AppPhones"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "People"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,68 +0,0 @@ |
|||
// <auto-generated />
|
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage; |
|||
using Microsoft.EntityFrameworkCore.Storage.Internal; |
|||
using System; |
|||
using Volo.Abp.TestApp.Domain; |
|||
using Volo.Abp.TestApp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Tests.Migrations |
|||
{ |
|||
[DbContext(typeof(TestAppDbContext))] |
|||
[Migration("20171026084129_Added_TenantId_To_Person")] |
|||
partial class Added_TenantId_To_Person |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452"); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Person", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("Age"); |
|||
|
|||
b.Property<string>("Name"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("People"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Number"); |
|||
|
|||
b.Property<Guid>("PersonId"); |
|||
|
|||
b.Property<int>("Type"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("PersonId"); |
|||
|
|||
b.ToTable("AppPhones"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.TestApp.Domain.Person") |
|||
.WithMany("Phones") |
|||
.HasForeignKey("PersonId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using System; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Tests.Migrations |
|||
{ |
|||
public partial class Added_TenantId_To_Person : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "TenantId", |
|||
table: "People", |
|||
type: "BLOB", |
|||
nullable: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "TenantId", |
|||
table: "People"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,70 +0,0 @@ |
|||
// <auto-generated />
|
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage; |
|||
using Microsoft.EntityFrameworkCore.Storage.Internal; |
|||
using System; |
|||
using Volo.Abp.TestApp.Domain; |
|||
using Volo.Abp.TestApp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Tests.Migrations |
|||
{ |
|||
[DbContext(typeof(TestAppDbContext))] |
|||
[Migration("20171026101049_Added_IsDeleted_To_Person")] |
|||
partial class Added_IsDeleted_To_Person |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452"); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Person", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("Age"); |
|||
|
|||
b.Property<bool>("IsDeleted"); |
|||
|
|||
b.Property<string>("Name"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("People"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Number"); |
|||
|
|||
b.Property<Guid>("PersonId"); |
|||
|
|||
b.Property<int>("Type"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("PersonId"); |
|||
|
|||
b.ToTable("AppPhones"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.TestApp.Domain.Person") |
|||
.WithMany("Phones") |
|||
.HasForeignKey("PersonId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Tests.Migrations |
|||
{ |
|||
public partial class Added_IsDeleted_To_Person : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<bool>( |
|||
name: "IsDeleted", |
|||
table: "People", |
|||
type: "INTEGER", |
|||
nullable: false, |
|||
defaultValue: false); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "IsDeleted", |
|||
table: "People"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,69 +0,0 @@ |
|||
// <auto-generated />
|
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage; |
|||
using Microsoft.EntityFrameworkCore.Storage.Internal; |
|||
using System; |
|||
using Volo.Abp.TestApp.Domain; |
|||
using Volo.Abp.TestApp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Tests.Migrations |
|||
{ |
|||
[DbContext(typeof(TestAppDbContext))] |
|||
partial class TestAppDbContextModelSnapshot : ModelSnapshot |
|||
{ |
|||
protected override void BuildModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.0.0-rtm-26452"); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Person", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("Age"); |
|||
|
|||
b.Property<bool>("IsDeleted"); |
|||
|
|||
b.Property<string>("Name"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("People"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Number"); |
|||
|
|||
b.Property<Guid>("PersonId"); |
|||
|
|||
b.Property<int>("Type"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("PersonId"); |
|||
|
|||
b.ToTable("AppPhones"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TestApp.Domain.Phone", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.TestApp.Domain.Person") |
|||
.WithMany("Phones") |
|||
.HasForeignKey("PersonId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.TestApp.Domain; |
|||
|
|||
namespace Volo.Abp.TestApp.EntityFrameworkCore |
|||
{ |
|||
public class CityRepository : EfCoreRepository<TestAppDbContext, City, Guid>, ICityRepository |
|||
{ |
|||
public CityRepository(IDbContextProvider<TestAppDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async Task<City> FindByNameAsync(string name) |
|||
{ |
|||
return await this.FirstOrDefaultAsync(c => c.Name == name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using MongoDB.Driver; |
|||
using Volo.Abp.Domain.Repositories.MongoDB; |
|||
using Volo.Abp.MongoDB; |
|||
using Volo.Abp.TestApp.Domain; |
|||
|
|||
namespace Volo.Abp.TestApp.MongoDb |
|||
{ |
|||
public class CityRepository : MongoDbRepository<ITestAppMongoDbContext, City, Guid>,ICityRepository |
|||
{ |
|||
public CityRepository(IMongoDatabaseProvider<ITestAppMongoDbContext> databaseProvider) |
|||
: base(databaseProvider) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public async Task<City> FindByNameAsync(string name) |
|||
{ |
|||
return await (await Collection.FindAsync(c => c.Name == name)).FirstOrDefaultAsync(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Volo.Abp.TestApp.Domain |
|||
{ |
|||
public class City : AggregateRoot<Guid> |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
private City() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public City(Guid id, string name) |
|||
: base(id) |
|||
{ |
|||
Name = name; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Volo.Abp.TestApp.Domain |
|||
{ |
|||
public interface ICityRepository : IBasicRepository<City, Guid> |
|||
{ |
|||
[CanBeNull] |
|||
Task<City> FindByNameAsync(string name); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue