mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
4.9 KiB
206 lines
4.9 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using Volo.Abp.Domain.Entities;
|
|
using Volo.Abp.Domain.Entities.Auditing;
|
|
using Volo.Abp.Domain.Values;
|
|
|
|
namespace Volo.Abp.TestApp.Domain;
|
|
|
|
public class AppEntityWithNavigations : FullAuditedAggregateRoot<Guid>
|
|
{
|
|
protected AppEntityWithNavigations()
|
|
{
|
|
|
|
}
|
|
|
|
public AppEntityWithNavigations(Guid id, string name)
|
|
: base(id)
|
|
{
|
|
Name = name;
|
|
FullName = name;
|
|
}
|
|
|
|
public string Name { get; set; }
|
|
|
|
public string FullName { get; set; }
|
|
|
|
|
|
public AppEntityWithValueObjectAddress AppEntityWithValueObjectAddress { get; set; }
|
|
|
|
public virtual AppEntityWithNavigationChildOneToOne OneToOne { get; set; }
|
|
|
|
public virtual List<AppEntityWithNavigationChildOneToMany> OneToMany { get; set; }
|
|
|
|
public virtual List<AppEntityWithNavigationChildManyToMany> ManyToMany { get; set; }
|
|
|
|
public virtual Guid? AppEntityWithNavigationForeignId { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithValueObjectAddress : ValueObject
|
|
{
|
|
public AppEntityWithValueObjectAddress(string country)
|
|
{
|
|
Country = country;
|
|
}
|
|
|
|
public string Country { get; set; }
|
|
|
|
protected override IEnumerable<object> GetAtomicValues()
|
|
{
|
|
yield return Country;
|
|
}
|
|
}
|
|
|
|
public class AppEntityWithNavigationChildOneToOne : Entity<Guid>
|
|
{
|
|
public string ChildName { get; set; }
|
|
|
|
public virtual AppEntityWithNavigationChildOneToOneAndOneToOne OneToOne { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithNavigationChildOneToOneAndOneToOne : Entity<Guid>
|
|
{
|
|
public string ChildName { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithNavigationChildOneToMany : Entity<Guid>
|
|
{
|
|
public AppEntityWithNavigationChildOneToMany()
|
|
{
|
|
|
|
}
|
|
|
|
public AppEntityWithNavigationChildOneToMany(Guid id)
|
|
: base(id)
|
|
{
|
|
|
|
}
|
|
|
|
public Guid AppEntityWithNavigationId { get; set; }
|
|
|
|
public string ChildName { get; set; }
|
|
|
|
public virtual List<AppEntityWithNavigationChildOneToManyAndOneToMany> OneToMany { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithNavigationChildOneToManyAndOneToMany : Entity<Guid>
|
|
{
|
|
public Guid AppEntityWithNavigationChildOneToManyId { get; set; }
|
|
|
|
public string ChildName { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithNavigationChildManyToMany : AggregateRoot<Guid>
|
|
{
|
|
public string ChildName { get; set; }
|
|
|
|
public virtual List<AppEntityWithNavigations> ManyToMany { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithNavigationsAndAppEntityWithNavigationChildManyToMany
|
|
{
|
|
public Guid AppEntityWithNavigationsId { get; set; }
|
|
|
|
public Guid AppEntityWithNavigationChildManyToManyId { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithNavigationsForeign : AggregateRoot<Guid>
|
|
{
|
|
protected AppEntityWithNavigationsForeign()
|
|
{
|
|
|
|
}
|
|
|
|
public AppEntityWithNavigationsForeign(Guid id, string name)
|
|
: base(id)
|
|
{
|
|
Name = name;
|
|
}
|
|
|
|
public string Name { get; set; }
|
|
|
|
public virtual List<AppEntityWithNavigations> OneToMany { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Has no navigation property to <see cref="AppEntityWithForeignKeyOnlyChild"/>,
|
|
/// the relation is only a foreign key on the child.
|
|
/// </summary>
|
|
public class AppEntityWithForeignKeyOnly : AggregateRoot<Guid>
|
|
{
|
|
protected AppEntityWithForeignKeyOnly()
|
|
{
|
|
|
|
}
|
|
|
|
public AppEntityWithForeignKeyOnly(Guid id, string name)
|
|
: base(id)
|
|
{
|
|
Name = name;
|
|
}
|
|
|
|
public string Name { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithForeignKeyOnlyChild : AggregateRoot<Guid>
|
|
{
|
|
protected AppEntityWithForeignKeyOnlyChild()
|
|
{
|
|
|
|
}
|
|
|
|
public AppEntityWithForeignKeyOnlyChild(Guid id, Guid appEntityWithForeignKeyOnlyId, string name)
|
|
: base(id)
|
|
{
|
|
AppEntityWithForeignKeyOnlyId = appEntityWithForeignKeyOnlyId;
|
|
Name = name;
|
|
}
|
|
|
|
public Guid AppEntityWithForeignKeyOnlyId { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
}
|
|
|
|
public class AppEntityWithForeignKeyOnlyOwner : AggregateRoot<Guid>
|
|
{
|
|
protected AppEntityWithForeignKeyOnlyOwner()
|
|
{
|
|
|
|
}
|
|
|
|
public AppEntityWithForeignKeyOnlyOwner(Guid id, string name)
|
|
: base(id)
|
|
{
|
|
Name = name;
|
|
}
|
|
|
|
public string Name { get; set; }
|
|
|
|
public virtual List<AppEntityWithForeignKeyOnlyEntityChild> Children { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Belongs to the <see cref="AppEntityWithForeignKeyOnlyOwner"/> aggregate,
|
|
/// but references the <see cref="AppEntityWithForeignKeyOnly"/> aggregate root with a foreign key only.
|
|
/// </summary>
|
|
public class AppEntityWithForeignKeyOnlyEntityChild : Entity<Guid>
|
|
{
|
|
protected AppEntityWithForeignKeyOnlyEntityChild()
|
|
{
|
|
|
|
}
|
|
|
|
public AppEntityWithForeignKeyOnlyEntityChild(Guid id, Guid ownerId, Guid appEntityWithForeignKeyOnlyId, string name)
|
|
: base(id)
|
|
{
|
|
OwnerId = ownerId;
|
|
AppEntityWithForeignKeyOnlyId = appEntityWithForeignKeyOnlyId;
|
|
Name = name;
|
|
}
|
|
|
|
public Guid OwnerId { get; set; }
|
|
|
|
public Guid AppEntityWithForeignKeyOnlyId { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
}
|
|
|