internal static ValidationResult Validate(TypedEntitySetHasItemType link, bool workWithTransaction) { ValidationResult result = new ValidationResult(); if (link != null && (!workWithTransaction || !link.CurrentTransactionIsSerializing())) { if (link.TypeOfItem != null) { if (!link.TypeOfItem.TypeKind.In(PersistentTypeKind.Entity, PersistentTypeKind.Interface)) { result.IsValid = false; result.ErrorCode = "InvalidItemType"; result.ValidationElements = new[] { link.TypedEntitySet }; result.ErrorMessage = string.Format( "Item type of Typed EntitySet '{0}' is set to '{1}' of type '{2}' which is not allowed. Only Entity and Interface are allowed types for Item Type.", link.TypedEntitySet.Name, link.TypeOfItem.Name, link.TypeOfItem.TypeKind); } } if (!result.IsValid && workWithTransaction) { link.RollbackCurrentTransaction(result.ErrorMessage); } } return(result); }
private void RemoveTypedEntitySetConnectionFromNavigationProperties(InterfaceInheritInterfaces link) { Interface targetInterface = link.TargetInheritByInterface; var typedEntitySets = TypedEntitySetHasItemType.GetTypedEntitySets(targetInterface); if (typedEntitySets != null) { foreach (TypedEntitySet typedEntitySet in typedEntitySets) { var navigationPropertiesLink = NavigationPropertyHasTypedEntitySet.GetTypedEntitySetNavigationProperties(typedEntitySet); if (navigationPropertiesLink != null) { foreach (NavigationProperty navigationProperty in navigationPropertiesLink) { } } } } }
public override void RolePlayerChanged(RolePlayerChangedEventArgs e) { TypedEntitySetHasItemType link = e.ElementLink as TypedEntitySetHasItemType; Validate(link); }
internal static ValidationResult Validate(TypedEntitySetHasItemType link) { return(Validate(link, true)); }
public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e) { TypedEntitySetHasItemType link = e.ModelElement as TypedEntitySetHasItemType; Validate(link); }