diff --git a/src/OpenRiaServices.Tools/Framework/MetadataPipeline/EntityAssociationAttributeBuilder.cs b/src/OpenRiaServices.Tools/Framework/MetadataPipeline/EntityAssociationAttributeBuilder.cs index da24db5e9..6e02447d2 100644 --- a/src/OpenRiaServices.Tools/Framework/MetadataPipeline/EntityAssociationAttributeBuilder.cs +++ b/src/OpenRiaServices.Tools/Framework/MetadataPipeline/EntityAssociationAttributeBuilder.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; @@ -17,14 +18,14 @@ internal class EntityAssociationAttributeBuilder : ICustomAttributeBuilder public AttributeDeclaration GetAttributeDeclaration(Attribute attribute) { string name; - string[] thisKey, otherKey; + IReadOnlyList thisKey, otherKey; bool isForeignKey; if (attribute is EntityAssociationAttribute entityAssociation) { name = entityAssociation.Name; - thisKey = (string[])entityAssociation.ThisKeyMembers; - otherKey = (string[])entityAssociation.OtherKeyMembers; + thisKey = entityAssociation.ThisKeyMembers; + otherKey = entityAssociation.OtherKeyMembers; isForeignKey = entityAssociation.IsForeignKey; } else if (attribute is AssociationAttribute associationAttribute) @@ -43,7 +44,7 @@ public AttributeDeclaration GetAttributeDeclaration(Attribute attribute) // If there is only a single key member, we use string based constructor AttributeDeclaration attributeDeclaration = new AttributeDeclaration(typeof(EntityAssociationAttribute)); attributeDeclaration.ConstructorArguments.Add(name); - if (thisKey.Length == 1 && otherKey.Length == 1) + if (thisKey.Count == 1 && otherKey.Count == 1) { attributeDeclaration.ConstructorArguments.Add(thisKey[0]); attributeDeclaration.ConstructorArguments.Add(otherKey[0]); diff --git a/src/Test/Desktop/OpenRiaServices.Common.DomainServices.Test/Cities/CityEntities.cs b/src/Test/Desktop/OpenRiaServices.Common.DomainServices.Test/Cities/CityEntities.cs index 4cac0d60c..a1ad02ab9 100644 --- a/src/Test/Desktop/OpenRiaServices.Common.DomainServices.Test/Cities/CityEntities.cs +++ b/src/Test/Desktop/OpenRiaServices.Common.DomainServices.Test/Cities/CityEntities.cs @@ -82,7 +82,7 @@ public partial class CityWithInfoMetadata [StringLength(32)] public string Info { get; set; } - [Association("CityWithInfo_ZipWithInfo", "Name, CountyName, StateName", "CityName, CountyName, StateName")] + [EntityAssociation("CityWithInfo_ZipWithInfo", ["Name", "CountyName", "StateName"], ["CityName", "CountyName", "StateName"])] public List ZipCodesWithInfo { get; set; } } @@ -132,7 +132,7 @@ public partial class StateMetadata [RoundtripOriginal] public string FullName { get; set; } - [Association("State_County", "Name", "StateName")] + [EntityAssociation("State_County", "Name", "StateName")] [CustomValidation(typeof(CountiesValidator), "AreCountiesValid")] public List Counties { get; set; } }