Exemplo n.º 1
0
        private static void FillNavigationPropertyAndPrincipal(NavigationPropertyMetadata navProp, object source, object target)
        {
            ////using (new ChangeTrackingScope(ChangeTracking.Disable, source, target))
            ////{
            navProp.SetValue(source, target);

            // das geladene Property als geladen markieren
            ////source.MarkNavigationPropertyAsLoaded(navProp.Name);

            if (navProp.TargetNavigationProperty != null)
            {
                if (navProp.TargetNavigationProperty.Multiplicity == NavigationPropertyMultiplicity.Many)
                {
                    navProp.TargetNavigationProperty.AddItem(target, source);
                }
                else
                {
                    navProp.TargetNavigationProperty.SetValue(target, source);

                    // am Ziel markieren, dass es geladen ist
                    ////target.MarkNavigationPropertyAsLoaded(navProp.TargetNavigationProperty.Name);
                }
            }
        }