/// <summary> /// Constructs a new constraint on the relationship /// </summary> /// <param name="fromRole">role from which the relationship originates</param> /// <param name="toRole">role to which the relationship is linked/targeted to</param> /// <param name="toProperties">properties on entity type of from role which take part in the constraint</param> /// <param name="fromProperties">properties on entity type of to role which take part in the constraint</param> /// <exception cref="ArgumentNullException">Argument Null exception if any of the arguments is null</exception> internal ReferentialConstraint(RelationshipEndMember fromRole, RelationshipEndMember toRole, IEnumerable<EdmProperty> fromProperties, IEnumerable<EdmProperty> toProperties) { _fromRole = EntityUtil.GenericCheckArgumentNull(fromRole, "fromRole"); _toRole = EntityUtil.GenericCheckArgumentNull(toRole, "toRole"); _fromProperties = new ReadOnlyMetadataCollection<EdmProperty>(new MetadataCollection<EdmProperty>( EntityUtil.GenericCheckArgumentNull(fromProperties, "fromProperties"))); _toProperties = new ReadOnlyMetadataCollection<EdmProperty>(new MetadataCollection<EdmProperty>( EntityUtil.GenericCheckArgumentNull(toProperties, "toProperties"))); }
/// <summary> /// Emit the GetRelatedCollection or GetRelatedReference methods /// </summary> /// <param name="target">Target end of the relationship</param> /// <returns>Expression to invoke the appropriate method</returns> private CodeExpression EmitGetMethod(RelationshipEndMember target) { return new CodeFieldReferenceExpression(ThisRef, Utils.FieldNameFromPropName(Item.Name)); }
private static EntityTypeBase GetEntityType(RelationshipEndMember endMember) { Debug.Assert((BuiltInTypeKind.RefType == endMember.TypeUsage.EdmType.BuiltInTypeKind), "not a reference type"); EntityTypeBase type = ((RefType)endMember.TypeUsage.EdmType).ElementType; return type; }
/// <summary> /// Get the return type for the get method, given the target end /// </summary> /// <param name="target"></param> /// <param name="referenceMethod">true if the is the return type for a reference property</param> /// <returns>the return type for a target</returns> private CodeTypeReference GetReturnType(RelationshipEndMember target) { CodeTypeReference returnType = Generator.GetLeastPossibleQualifiedTypeReference(GetEntityType(target)); if (target.RelationshipMultiplicity == RelationshipMultiplicity.Many) { returnType = TypeReference.FrameworkGenericClass(this.Generator.GetRelationshipMultiplicityManyCollectionTypeName(), returnType); } return returnType; }
internal RelProperty(RelationshipType relationshipType, RelationshipEndMember fromEnd, RelationshipEndMember toEnd) { m_relationshipType = relationshipType; m_fromEnd = fromEnd; m_toEnd = toEnd; }
/// <summary> /// Get the return type for the get method, given the target end /// </summary> /// <param name="target"></param> /// <param name="referenceMethod">true if the is the return type for a reference property</param> /// <returns>the return type for a target</returns> private CodeTypeReference GetReturnType(RelationshipEndMember target, bool referenceMethod) { CodeTypeReference returnType = Generator.GetLeastPossibleQualifiedTypeReference(GetEntityType(target)); if (referenceMethod) { returnType = TypeReference.AdoFrameworkGenericDataClass("EntityReference", returnType); } else if (target.RelationshipMultiplicity == RelationshipMultiplicity.Many) { returnType = TypeReference.AdoFrameworkGenericDataClass("EntityCollection", returnType); } return returnType; }
// requires: role must not be null and property must be a key member for the role end private static int GetKeyMemberOffset(RelationshipEndMember role, EdmProperty property, out int keyMemberCount) { Debug.Assert(null != role); Debug.Assert(null != property); Debug.Assert(BuiltInTypeKind.RefType == role.TypeUsage.EdmType.BuiltInTypeKind, "relationship ends must be of RefType"); RefType endType = (RefType)role.TypeUsage.EdmType; Debug.Assert(BuiltInTypeKind.EntityType == endType.ElementType.BuiltInTypeKind, "relationship ends must reference EntityType"); EntityType entityType = (EntityType)endType.ElementType; keyMemberCount = entityType.KeyMembers.Count; return entityType.KeyMembers.IndexOf(property); }
/// <summary> /// Builds up a join between the relationshipset and the entityset corresponding to its toEnd. In essence, /// we produce /// SELECT r, e /// FROM RS as r, OFTYPE(ES, T) as e /// WHERE r.ToEnd = Ref(e) /// /// "T" is the entity type of the toEnd of the relationship. /// </summary> /// <param name="relSet">the relationshipset</param> /// <param name="end">the toEnd of the relationship</param> /// <param name="rsVar">the var representing the relationship instance ("r") in the output subquery</param> /// <param name="esVar">the var representing the entity instance ("e") in the output subquery</param> /// <returns>the join subquery described above</returns> private Node BuildJoinForNavProperty( RelationshipSet relSet, RelationshipEndMember end, out Var rsVar, out Var esVar) { var entitySet = FindTargetEntitySet(relSet, end); // // Build out the ScanTable ops for the relationshipset and the entityset. Add the // var asTableNode = BuildOfTypeTable(relSet, null, out rsVar); var esTableNode = BuildOfTypeTable(entitySet, TypeHelpers.GetElementTypeUsage(end.TypeUsage), out esVar); // // Build up a join between the entityset and the associationset; join on the to-end // var joinPredicate = m_command.BuildComparison( OpType.EQ, m_command.CreateNode(m_command.CreateGetEntityRefOp(end.TypeUsage), m_command.CreateNode(m_command.CreateVarRefOp(esVar))), m_command.CreateNode(m_command.CreatePropertyOp(end), m_command.CreateNode(m_command.CreateVarRefOp(rsVar))) ); var joinNode = m_command.CreateNode( m_command.CreateInnerJoinOp(), asTableNode, esTableNode, joinPredicate); return joinNode; }
protected virtual void Visit(RelationshipEndMember relationshipEndMember) { Visit(relationshipEndMember.TypeUsage); }
protected override void Visit(RelationshipEndMember relationshipEndMember) { int index; if (!this.AddObjectToSeenListAndHashBuilder(relationshipEndMember, out index)) { return; } this.AddObjectStartDumpToHashBuilder(relationshipEndMember, index); #region Inner data visit this.AddObjectContentToHashBuilder(relationshipEndMember.DeleteBehavior); this.AddObjectContentToHashBuilder(relationshipEndMember.Identity); // Name is covered by Identity this.AddObjectContentToHashBuilder(relationshipEndMember.IsStoreGeneratedComputed); this.AddObjectContentToHashBuilder(relationshipEndMember.IsStoreGeneratedIdentity); this.AddObjectContentToHashBuilder(relationshipEndMember.RelationshipMultiplicity); base.Visit(relationshipEndMember); #endregion this.AddObjectEndDumpToHashBuilder(); }
public EntitySet GetEntitySet(RelationshipEndMember end) { EntityType type = RelationshipEndTypeLookup[end]; return EntityTypeToSet[type]; }
/// <summary> /// Generate a navigation property /// </summary> /// <param name="target">the other end</param> /// <param name="referenceProperty">True to emit Reference navigation property</param> /// <returns>the generated property</returns> private CodeMemberProperty EmitNavigationProperty(RelationshipEndMember target, bool referenceProperty) { CodeTypeReference typeRef = GetReturnType(target, referenceProperty); // raise the PropertyGenerated event PropertyGeneratedEventArgs eventArgs = new PropertyGeneratedEventArgs(Item, null, // no backing field typeRef); this.Generator.RaisePropertyGeneratedEvent(eventArgs); // [System.ComponentModel.Browsable(false)] // public TargetType TargetName // public EntityReference<TargetType> TargetName // or // public EntityCollection<targetType> TargetNames CodeMemberProperty property = new CodeMemberProperty(); if (referenceProperty) { AttributeEmitter.AddBrowsableAttribute(property); Generator.AttributeEmitter.EmitGeneratedCodeAttribute(property); } else { Generator.AttributeEmitter.EmitNavigationPropertyAttributes(Generator, target, property, eventArgs.AdditionalAttributes); // Only reference navigation properties are currently currently supported with XML serialization // and thus we should use the XmlIgnore and SoapIgnore attributes on other property types. AttributeEmitter.AddIgnoreAttributes(property); } AttributeEmitter.AddDataMemberAttribute(property); CommentEmitter.EmitSummaryComments(Item, property.Comments); property.Name = Item.Name; if (referenceProperty) { property.Name += "Reference"; if (IsNameAlreadyAMemberName(Item.DeclaringType, property.Name, Generator.LanguageAppropriateStringComparer)) { Generator.AddError(Strings.GeneratedNavigationPropertyNameConflict(Item.Name, Item.DeclaringType.Name, property.Name), ModelBuilderErrorCode.GeneratedNavigationPropertyNameConflict, EdmSchemaErrorSeverity.Error, Item.DeclaringType.FullName, property.Name); } } if (eventArgs.ReturnType != null && !eventArgs.ReturnType.Equals(typeRef)) { property.Type = eventArgs.ReturnType; } else { property.Type = typeRef; } property.Attributes = MemberAttributes.Final; CodeMethodInvokeExpression getMethod = EmitGetMethod(target); CodeExpression getReturnExpression; property.Attributes |= AccessibilityFromGettersAndSetters(Item); // setup the accessibility of the navigation property setter and getter MemberAttributes propertyAccessibility = property.Attributes & MemberAttributes.AccessMask; PropertyEmitter.AddGetterSetterFixUp(Generator.FixUps, GetFullyQualifiedPropertyName(property.Name), PropertyEmitter.GetGetterAccessibility(Item), propertyAccessibility, true); PropertyEmitter.AddGetterSetterFixUp(Generator.FixUps, GetFullyQualifiedPropertyName(property.Name), PropertyEmitter.GetSetterAccessibility(Item), propertyAccessibility, false); if (target.RelationshipMultiplicity != RelationshipMultiplicity.Many) { // insert user-supplied Set code here, before the assignment // List<CodeStatement> additionalSetStatements = eventArgs.AdditionalSetStatements; if (additionalSetStatements != null && additionalSetStatements.Count > 0) { try { property.SetStatements.AddRange(additionalSetStatements.ToArray()); } catch (ArgumentNullException ex) { Generator.AddError(Strings.InvalidSetStatementSuppliedForProperty(Item.Name), ModelBuilderErrorCode.InvalidSetStatementSuppliedForProperty, EdmSchemaErrorSeverity.Error, ex); } } CodeExpression valueRef = new CodePropertySetValueReferenceExpression(); if(typeRef != eventArgs.ReturnType) { // we need to cast to the actual type valueRef = new CodeCastExpression(typeRef, valueRef); } if (referenceProperty) { // get // return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<TTargetEntity>("CSpaceQualifiedRelationshipName", "TargetRoleName"); getReturnExpression = getMethod; // set // if (value != null) // { // ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<TTargetEntity>"CSpaceQualifiedRelationshipName", "TargetRoleName", value); // } CodeMethodReferenceExpression initReferenceMethod = new CodeMethodReferenceExpression(); initReferenceMethod.MethodName = "InitializeRelatedReference"; initReferenceMethod.TypeArguments.Add(Generator.GetLeastPossibleQualifiedTypeReference(GetEntityType(target))); initReferenceMethod.TargetObject = new CodePropertyReferenceExpression( new CodeCastExpression(TypeReference.IEntityWithRelationshipsTypeBaseClass, ThisRef), "RelationshipManager"); // relationships aren't backed by types so we won't map the namespace // or we can't find the relationship again later string cspaceNamespaceNameQualifiedRelationshipName = target.DeclaringType.FullName; property.SetStatements.Add( new CodeConditionStatement( EmitExpressionDoesNotEqualNull(valueRef), new CodeExpressionStatement( new CodeMethodInvokeExpression( initReferenceMethod, new CodeExpression[] { new CodePrimitiveExpression(cspaceNamespaceNameQualifiedRelationshipName), new CodePrimitiveExpression(target.Name), valueRef})))); } else { CodePropertyReferenceExpression valueProperty = new CodePropertyReferenceExpression(getMethod, ValuePropertyName); // get // return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<TTargetEntity>("CSpaceQualifiedRelationshipName", "TargetRoleName").Value; getReturnExpression = valueProperty; // set // ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<TTargetEntity>("CSpaceQualifiedRelationshipName", "TargetRoleName").Value = value; property.SetStatements.Add( new CodeAssignStatement(valueProperty, valueRef)); } } else { // get // return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<TTargetEntity>("CSpaceQualifiedRelationshipName", "TargetRoleName"); getReturnExpression = getMethod; // set // if (value != null) // { // ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<TTargetEntity>"CSpaceQualifiedRelationshipName", "TargetRoleName", value); // } CodeExpression valueRef = new CodePropertySetValueReferenceExpression(); CodeMethodReferenceExpression initCollectionMethod = new CodeMethodReferenceExpression(); initCollectionMethod.MethodName = "InitializeRelatedCollection"; initCollectionMethod.TypeArguments.Add(Generator.GetLeastPossibleQualifiedTypeReference(GetEntityType(target))); initCollectionMethod.TargetObject = new CodePropertyReferenceExpression( new CodeCastExpression(TypeReference.IEntityWithRelationshipsTypeBaseClass, ThisRef), "RelationshipManager"); // relationships aren't backed by types so we won't map the namespace // or we can't find the relationship again later string cspaceNamespaceNameQualifiedRelationshipName = target.DeclaringType.FullName; property.SetStatements.Add( new CodeConditionStatement( EmitExpressionDoesNotEqualNull(valueRef), new CodeExpressionStatement( new CodeMethodInvokeExpression( initCollectionMethod, new CodeExpression[] { new CodePrimitiveExpression(cspaceNamespaceNameQualifiedRelationshipName), new CodePrimitiveExpression(target.Name), valueRef})))); } // if additional Get statements were specified by the event subscriber, insert them now // List<CodeStatement> additionalGetStatements = eventArgs.AdditionalGetStatements; if (additionalGetStatements != null && additionalGetStatements.Count > 0) { try { property.GetStatements.AddRange(additionalGetStatements.ToArray()); } catch (ArgumentNullException ex) { Generator.AddError(Strings.InvalidGetStatementSuppliedForProperty(Item.Name), ModelBuilderErrorCode.InvalidGetStatementSuppliedForProperty, EdmSchemaErrorSeverity.Error, ex); } } property.GetStatements.Add(new CodeMethodReturnStatement(getReturnExpression)); return property; }
/// <summary> /// Emit the GetRelatedCollection or GetRelatedReference methods /// </summary> /// <param name="target">Target end of the relationship</param> /// <returns>Expression to invoke the appropriate method</returns> private CodeMethodInvokeExpression EmitGetMethod(RelationshipEndMember target) { // ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<TargetType>("CSpaceQualifiedRelationshipName", "TargetRoleName"); // or // ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<TargetType>("CSpaceQualifiedRelationshipName", "TargetRoleName"); CodeMethodReferenceExpression getMethod = new CodeMethodReferenceExpression(); if (target.RelationshipMultiplicity != RelationshipMultiplicity.Many) getMethod.MethodName = "GetRelatedReference"; else getMethod.MethodName = "GetRelatedCollection"; getMethod.TypeArguments.Add(Generator.GetLeastPossibleQualifiedTypeReference(GetEntityType(target))); getMethod.TargetObject = new CodePropertyReferenceExpression( new CodeCastExpression(TypeReference.IEntityWithRelationshipsTypeBaseClass, ThisRef), "RelationshipManager"); // relationships aren't backed by types so we won't map the namespace // or we can't find the relationship again later string cspaceNamespaceNameQualifiedRelationshipName = target.DeclaringType.FullName; return new CodeMethodInvokeExpression( getMethod, new CodeExpression[] { new CodePrimitiveExpression(cspaceNamespaceNameQualifiedRelationshipName), new CodePrimitiveExpression(target.Name)}); }
/// <summary> /// Generate a navigation property /// </summary> /// <param name="target">the other end</param> /// <param name="referenceProperty">True to emit Reference navigation property</param> /// <returns>the generated property</returns> private CodeMemberProperty EmitNavigationProperty(RelationshipEndMember target) { CodeTypeReference typeRef = GetReturnType(target); // raise the PropertyGenerated event PropertyGeneratedEventArgs eventArgs = new PropertyGeneratedEventArgs(Item, null, // no backing field typeRef); this.Generator.RaisePropertyGeneratedEvent(eventArgs); // [System.ComponentModel.Browsable(false)] // public TargetType TargetName // public EntityReference<TargetType> TargetName // or // public EntityCollection<targetType> TargetNames CodeMemberProperty property = new CodeMemberProperty(); // Only reference navigation properties are currently currently supported with XML serialization // and thus we should use the XmlIgnore and SoapIgnore attributes on other property types. AttributeEmitter.AddIgnoreAttributes(property); AttributeEmitter.AddBrowsableAttribute(property); AttributeEmitter.AddGeneratedCodeAttribute(property); CommentEmitter.EmitSummaryComments(Item, property.Comments); property.Name = Item.Name; if (eventArgs.ReturnType != null && !eventArgs.ReturnType.Equals(typeRef)) { property.Type = eventArgs.ReturnType; } else { property.Type = typeRef; } property.Attributes = MemberAttributes.Final; CodeExpression getMethod = EmitGetMethod(target); CodeExpression getReturnExpression; if (target.RelationshipMultiplicity != RelationshipMultiplicity.Many) { property.Attributes |= AccessibilityFromGettersAndSetters(Item); // insert user-supplied Set code here, before the assignment // List<CodeStatement> additionalSetStatements = eventArgs.AdditionalSetStatements; if (additionalSetStatements != null && additionalSetStatements.Count > 0) { try { property.SetStatements.AddRange(additionalSetStatements.ToArray()); } catch (ArgumentNullException e) { Generator.AddError(Strings.InvalidSetStatementSuppliedForProperty(Item.Name), ModelBuilderErrorCode.InvalidSetStatementSuppliedForProperty, EdmSchemaErrorSeverity.Error, e); } } CodeExpression valueRef = new CodePropertySetValueReferenceExpression(); if (typeRef != eventArgs.ReturnType) { // we need to cast to the actual type valueRef = new CodeCastExpression(typeRef, valueRef); } CodeExpression valueProperty = getMethod; // get // return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<TTargetEntity>("CSpaceQualifiedRelationshipName", "TargetRoleName").Value; getReturnExpression = valueProperty; // set // ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<TTargetEntity>("CSpaceQualifiedRelationshipName", "TargetRoleName").Value = value; property.SetStatements.Add( new CodeAssignStatement(valueProperty, valueRef)); // setup the accessibility of the navigation property setter and getter MemberAttributes propertyAccessibility = property.Attributes & MemberAttributes.AccessMask; PropertyEmitter.AddGetterSetterFixUp(Generator.FixUps, GetFullyQualifiedPropertyName(property.Name), PropertyEmitter.GetGetterAccessibility(Item), propertyAccessibility, true); PropertyEmitter.AddGetterSetterFixUp(Generator.FixUps, GetFullyQualifiedPropertyName(property.Name), PropertyEmitter.GetSetterAccessibility(Item), propertyAccessibility, false); List<CodeStatement> additionalAfterSetStatements = eventArgs.AdditionalAfterSetStatements; if (additionalAfterSetStatements != null && additionalAfterSetStatements.Count > 0) { try { property.SetStatements.AddRange(additionalAfterSetStatements.ToArray()); } catch (ArgumentNullException e) { Generator.AddError(Strings.InvalidSetStatementSuppliedForProperty(Item.Name), ModelBuilderErrorCode.InvalidSetStatementSuppliedForProperty, EdmSchemaErrorSeverity.Error, e); } } } else { property.Attributes |= PropertyEmitter.GetGetterAccessibility(Item); // get // return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<TTargetEntity>("CSpaceQualifiedRelationshipName", "TargetRoleName"); getReturnExpression = getMethod; // set // if (value != null) ==> Only for non-binding scenario // { // this = // this.OnPropertyChanged("") // } CodeExpression valueRef = new CodePropertySetValueReferenceExpression(); CodeStatementCollection csc = null; if (this.Generator.UseDataServiceCollection == true) { csc = property.SetStatements; } else { CodeConditionStatement ccs = new CodeConditionStatement(EmitExpressionDoesNotEqualNull(valueRef)); property.SetStatements.Add(ccs); csc = ccs.TrueStatements; } csc.Add(new CodeAssignStatement(getMethod, valueRef)); if (eventArgs.AdditionalAfterSetStatements != null) { try { foreach (CodeStatement s in eventArgs.AdditionalAfterSetStatements) { csc.Add(s); } } catch (ArgumentNullException e) { Generator.AddError(Strings.InvalidSetStatementSuppliedForProperty(Item.Name), ModelBuilderErrorCode.InvalidSetStatementSuppliedForProperty, EdmSchemaErrorSeverity.Error, e); } } } // if additional Get statements were specified by the event subscriber, insert them now // List<CodeStatement> additionalGetStatements = eventArgs.AdditionalGetStatements; if (additionalGetStatements != null && additionalGetStatements.Count > 0) { try { property.GetStatements.AddRange(additionalGetStatements.ToArray()); } catch (ArgumentNullException ex) { Generator.AddError(Strings.InvalidGetStatementSuppliedForProperty(Item.Name), ModelBuilderErrorCode.InvalidGetStatementSuppliedForProperty, EdmSchemaErrorSeverity.Error, ex); } } property.GetStatements.Add(new CodeMethodReturnStatement(getReturnExpression)); return property; }
private static StructuralType GetRelationshipEndType(RelationshipEndMember relationshipEndMember) { return ((RefType)relationshipEndMember.TypeUsage.EdmType).ElementType; }
private static EntitySetBase FindTargetEntitySet(RelationshipSet relationshipSet, RelationshipEndMember targetEnd) { EntitySetBase entitySet = null; var associationSet = (AssociationSet)relationshipSet; // find the corresponding entityset entitySet = null; foreach (var e in associationSet.AssociationSetEnds) { if (e.CorrespondingAssociationEndMember.EdmEquals(targetEnd)) { entitySet = e.EntitySet; break; } } PlanCompiler.Assert( entitySet != null, "Could not find entity set for relationship set " + relationshipSet + ";association end " + targetEnd); return entitySet; }
/// <summary> /// Dumps the specified Relation End EdmMember metadata instance with the specified decoration /// </summary> /// <param name="end">The Relation End metadata to dump</param> /// <param name="name">The decorating block name</param> internal void Dump(RelationshipEndMember end, string name) { Begin(name); Begin( "RelationshipEndMember", "Name", end.Name, //"IsParent", end.IsParent, "RelationshipMultiplicity", Enum.GetName(typeof(RelationshipMultiplicity), end.RelationshipMultiplicity) ); Dump(end.DeclaringType, "DeclaringRelation"); Dump(end.TypeUsage, "EndType"); End("RelationshipEndMember"); End(name); }
internal static long BuildRelationshipKey(EntityType entityType, RelationshipEndMember member) { return Misc.CombineHashCodes(entityType.GetHashCode(), member.GetHashCode()); }
/// <summary> /// Emit the attributes for the new navigation property /// </summary> /// <param name="generator">The ClientApiGenerator instance</param> /// <param name="targetRelationshipEnd">The relationship end that is being targeted</param> /// <param name="propertyDecl">The property declaration to attach the attribute to.</param> /// <param name="additionalAttributes">Additional attributes</param> public void EmitNavigationPropertyAttributes(ClientApiGenerator generator, RelationshipEndMember targetRelationshipEnd, CodeMemberProperty propertyDecl, List<CodeAttributeDeclaration> additionalAttributes) { CodeAttributeDeclaration attribute = EmitSimpleAttribute(FQAdoFrameworkDataClassesName("EdmRelationshipNavigationPropertyAttribute"), targetRelationshipEnd.DeclaringType.NamespaceName, targetRelationshipEnd.DeclaringType.Name, targetRelationshipEnd.Name); propertyDecl.CustomAttributes.Add(attribute); EmitGeneratedCodeAttribute(propertyDecl); if (additionalAttributes != null && additionalAttributes.Count > 0) { try { propertyDecl.CustomAttributes.AddRange(additionalAttributes.ToArray()); } catch (ArgumentNullException e) { generator.AddError(Strings.InvalidAttributeSuppliedForProperty(propertyDecl.Name), ModelBuilderErrorCode.InvalidAttributeSuppliedForProperty, EdmSchemaErrorSeverity.Error, e); } } }