Will be great, if fields in structure can inherit configuration from outer field
Structure:
public sealed class TextedLink<TEntity> : Structure where TEntity : Entity
{
// Always not null
[Field(Nullable = false)]
public string Caption { get; set; }
// May be null
[Field(Nullable = true)]
public string Description { get; set; }
// Can be null or not depend on outer FieldAttribute
[Field(NullableInherited = true)]
public TEntity Link { get; set; }
}
Entity:
public partial class TestEntity : Entity
{
[Field(Nullable = false)]
public string Name { get; set; }
// Link can't be null
[Field(Nullable = false)]
public TextedLink<TestEntity> NotNullStructure { get; set; }
// Link can be null
[Field]
public TextedLink<TestEntity> NullStructure { get; set; }
Important moment, when 'Nullable = false', SQL should use INNER JOIN, otherwise use LEFT JOIN
Query.All<testentity>().Where(e => e.NotNullStructure.Link.Name == "test").Count(); // INNER JOIN
Query.All<testentity>().Where(e => e.NullStructure.Link.Name == "test").Count(); // LEFT JOIN
As I know, it's default behavior for link fields
asked
Oct 25 '16 at 09:15
Anton Guschin
73●30●30●35