Skip to content

Commit

Permalink
Merge pull request #405 from b4b4t/fix/add-mapping-support-association
Browse files Browse the repository at this point in the history
[Core] Ajout support des mappings dans les associations
  • Loading branch information
JabX authored Oct 29, 2024
2 parents 96d11d5 + 99b8115 commit 11dfee6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions TopModel.Core/Loaders/PropertyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ public IProperty Load(Parser parser)
while (parser.Current is not MappingEnd)
{
var prop = parser.Consume<Scalar>().Value;
var value = parser.Consume<Scalar>();
_ = parser.TryConsume<Scalar>(out var value);

switch (prop)
{
case "association":
ap.Reference = new ClassReference(value);
ap.Reference = new ClassReference(value!);
break;
case "role":
ap.Role = value.Value;
ap.Role = value!.Value;
break;
case "type":
ap.Type = value.Value switch
ap.Type = value!.Value switch
{
"oneToOne" => AssociationType.OneToOne,
"manyToOne" => AssociationType.ManyToOne,
Expand All @@ -103,28 +103,28 @@ public IProperty Load(Parser parser)
};
break;
case "as":
ap.As = value.Value;
ap.As = value!.Value;
break;
case "label":
ap.Label = value.Value;
ap.Label = value!.Value;
break;
case "required":
ap.Required = value.Value == "true";
ap.Required = value!.Value == "true";
break;
case "primaryKey":
ap.PrimaryKey = value.Value == "true";
ap.PrimaryKey = value!.Value == "true";
break;
case "readonly":
ap.Readonly = value.Value == "true";
ap.Readonly = value!.Value == "true";
break;
case "defaultValue":
ap.DefaultValue = value.Value;
ap.DefaultValue = value!.Value;
break;
case "comment":
ap.Comment = value.Value;
ap.Comment = value!.Value;
break;
case "property":
ap.PropertyReference = new Reference(value);
ap.PropertyReference = new Reference(value!);
break;
case "trigram":
ap.Trigram = new LocatedString(value);
Expand Down

0 comments on commit 11dfee6

Please sign in to comment.