Add constrators getting id to the base entity classes.

pull/1810/head
Halil İbrahim Kalkan 5 years ago
parent dcbd40a099
commit deb086e6a8

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual Guid? LastModifierId { get; set; }
protected AuditedAggregateRoot()
{
}
protected AuditedAggregateRoot(TKey id)
: base(id)
{
}
}
}

@ -32,5 +32,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual TUser LastModifier { get; set; }
protected AuditedAggregateRootWithUser()
{
}
protected AuditedAggregateRootWithUser(TKey id)
: base(id)
{
}
}
}

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual Guid? LastModifierId { get; set; }
protected AuditedEntity()
{
}
protected AuditedEntity(TKey id)
: base(id)
{
}
}
}

@ -32,5 +32,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual TUser LastModifier { get; set; }
protected AuditedEntityWithUser()
{
}
protected AuditedEntityWithUser(TKey id)
: base(id)
{
}
}
}

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual Guid? CreatorId { get; set; }
protected CreationAuditedAggregateRoot()
{
}
protected CreationAuditedAggregateRoot(TKey id)
: base(id)
{
}
}
}

@ -24,5 +24,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
{
/// <inheritdoc />
public virtual TUser Creator { get; set; }
protected CreationAuditedAggregateRootWithUser()
{
}
protected CreationAuditedAggregateRootWithUser(TKey id)
: base(id)
{
}
}
}

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual Guid? CreatorId { get; set; }
protected CreationAuditedEntity()
{
}
protected CreationAuditedEntity(TKey id)
: base(id)
{
}
}
}

@ -24,5 +24,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
{
/// <inheritdoc />
public virtual TUser Creator { get; set; }
protected CreationAuditedEntityWithUser()
{
}
protected CreationAuditedEntityWithUser(TKey id)
: base(id)
{
}
}
}

@ -34,5 +34,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual DateTime? DeletionTime { get; set; }
protected FullAuditedAggregateRoot()
{
}
protected FullAuditedAggregateRoot(TKey id)
: base(id)
{
}
}
}

@ -38,5 +38,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public TUser LastModifier { get; set; }
protected FullAuditedAggregateRootWithUser()
{
}
protected FullAuditedAggregateRootWithUser(TKey id)
: base(id)
{
}
}
}

@ -34,5 +34,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public virtual DateTime? DeletionTime { get; set; }
protected FullAuditedEntity()
{
}
protected FullAuditedEntity(TKey id)
: base(id)
{
}
}
}

@ -38,5 +38,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc />
public TUser LastModifier { get; set; }
protected FullAuditedEntityWithUser()
{
}
protected FullAuditedEntityWithUser(TKey id)
: base(id)
{
}
}
}

@ -6,5 +6,16 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
public class BookInSecondDbContext : AggregateRoot<Guid>
{
public string Name { get; set; }
public BookInSecondDbContext()
{
}
public BookInSecondDbContext(Guid id, string name)
: base(id)
{
Name = name;
}
}
}

@ -18,11 +18,12 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext
public void Build()
{
_bookRepository.Insert(new BookInSecondDbContext
{
Id = _guidGenerator.Create(),
Name = "TestBook1"
});
_bookRepository.Insert(
new BookInSecondDbContext(
_guidGenerator.Create(),
"TestBook1"
)
);
}
}
}

@ -80,7 +80,7 @@ namespace Volo.Abp.EntityFrameworkCore.Transactions
_unitOfWorkManager.Current.ShouldNotBeNull();
await _personRepository.InsertAsync(new Person(personId, "Adam", 42));
await _bookRepository.InsertAsync(new BookInSecondDbContext { Id = bookId, Name = bookId.ToString() });
await _bookRepository.InsertAsync(new BookInSecondDbContext(bookId, bookId.ToString()));
await _unitOfWorkManager.Current.SaveChangesAsync();

@ -21,7 +21,7 @@ namespace Volo.Abp.EventBus.Local
return Task.CompletedTask;
});
await LocalEventBus.PublishAsync(new EntityUpdatedEventData<Person>(new Person { Id = 42 }));
await LocalEventBus.PublishAsync(new EntityUpdatedEventData<Person>(new Person(42)));
triggeredEvent.ShouldBe(true);
}
@ -39,19 +39,37 @@ namespace Volo.Abp.EventBus.Local
return Task.CompletedTask;
});
await LocalEventBus.PublishAsync(new EntityChangedEventData<Student>(new Student { Id = 42 }));
await LocalEventBus.PublishAsync(new EntityChangedEventData<Student>(new Student(42)));
triggeredEvent.ShouldBe(true);
}
public class Person : Entity<int>
{
public Person()
{
}
public Person(int id)
: base(id)
{
}
}
public class Student : Person
{
public Student()
{
}
public Student(int id)
: base(id)
{
}
}
}
}

@ -23,8 +23,8 @@ namespace Volo.Abp.TestApp.Domain
}
public Person(Guid id, string name, int age, Guid? tenantId = null, Guid? cityId = null)
: base(id)
{
Id = id;
Name = name;
Age = age;
TenantId = tenantId;

@ -49,8 +49,8 @@ namespace Volo.Abp.TestApp.Domain
}
public Order(Guid id, string referenceNo)
: base(id)
{
Id = id;
ReferenceNo = referenceNo;
OrderLines = new List<OrderLine>();
}

@ -7,7 +7,9 @@ namespace MyCompanyName.MyProjectName.Controllers
{
public ActionResult Index()
{
return Redirect("/swagger");
//TODO: Enabled once Swagger supports ASP.NET Core 3.x
//return Redirect("/swagger");
return Content("OK: MyCompanyName.MyProjectName.HttpApi.HostWithIds is running...");
}
}
}

@ -7,7 +7,9 @@ namespace MyCompanyName.MyProjectName.Controllers
{
public ActionResult Index()
{
return Redirect("/swagger");
//TODO: Enabled once Swagger supports ASP.NET Core 3.x
//return Redirect("/swagger");
return Content("OK: MyCompanyName.MyProjectName.HttpApi.HostWithIds is running...");
}
}
}

Loading…
Cancel
Save