Beispiel #1
0
        ///<summary>Unregisters event handlers registered in Register.</summary>
        public override void Unregister(Table table)
        {
            var rc = GetRowCollection(table);

            rc.RowAdded   -= DependentRowAdded;
            rc.RowRemoved -= DependentRowRemoved;

            if (DependentColumns.Any())
            {
                rc.ValueChanged -= DependentValueChanged;
            }

            foreach (var child in NestedDependencies)
            {
                child.Unregister(table);
            }
        }
Beispiel #2
0
        private void SetMultiplicities()
        {
            _assocationType.SourceEnd.RelationshipMultiplicity = RelationshipMultiplicity.ZeroOrOne;
            _assocationType.TargetEnd.RelationshipMultiplicity = RelationshipMultiplicity.Many;

            var dependentTable = _assocationType.TargetEnd.GetEntityType();

            if (dependentTable.DeclaredKeyProperties.Count() == DependentColumns.Count() &&
                dependentTable.DeclaredKeyProperties.All(DependentColumns.Contains))
            {
                _assocationType.SourceEnd.RelationshipMultiplicity = RelationshipMultiplicity.One;
                _assocationType.TargetEnd.RelationshipMultiplicity = RelationshipMultiplicity.ZeroOrOne;
            }
            else if (!DependentColumns.Any(p => p.Nullable))
            {
                _assocationType.SourceEnd.RelationshipMultiplicity = RelationshipMultiplicity.One;
            }
        }