Esempio n. 1
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var sp = efContainer as ScalarProperty;

            if (sp != null)
            {
                _scalarProperties.Remove(sp);
                return;
            }

            var cp = efContainer as ComplexProperty;

            if (cp != null)
            {
                _complexProperties.Remove(cp);
                return;
            }

            var cond = efContainer as Condition;

            if (cond != null)
            {
                _conditions.Remove(cond);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 2
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as BaseEntityContainer;

            if (child1 != null)
            {
                _entityContainers.Remove(child1);
                return;
            }

            var child2 = efContainer as EntityType;

            if (child2 != null)
            {
                _entityTypes.Remove(child2);
                return;
            }

            var child3 = efContainer as Association;

            if (child3 != null)
            {
                _associations.Remove(child3);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as ComplexType;

            if (child1 != null)
            {
                _complexTypes.Remove(child1);
                return;
            }

            var child2 = efContainer as UsingElement;

            if (child2 != null)
            {
                _usings.Remove(child2);
                return;
            }

            var child3 = efContainer as EnumType;

            if (child3 != null)
            {
                _enumTypes.Remove(child3);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 4
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as EntitySetMapping;

            if (child1 != null)
            {
                _entitySetMappings.Remove(child1);
                return;
            }

            var child2 = efContainer as AssociationSetMapping;

            if (child2 != null)
            {
                _associationSetMappings.Remove(child2);
                return;
            }

            var child3 = efContainer as FunctionImportMapping;

            if (child3 != null)
            {
                _functionImportMappings.Remove(child3);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
    public QuizDomainObject GetQuiz(int id)
    {
        // using a DI/IoC container is the
        // preferred method instead of
        // access the datacontext directly
        using (EFContainer db = new EFContainer())
        {
            Dictionary <string, int> max = db.Registry
                                           .Where(x => x.Domain == "Quiz")
                                           .ToDictionary(x => x.Key, x => Convert.ToInt32(x.Value));

            var quiz = from q in db.Quizes
                       where q.Id equals id
                       select new QuizDomainObject()
            {
                Id = q.Id,
                // all other propeties,

                // I'm still unclear about the structure of your
                // database and how it interlates, you'll need
                // to figure out the query correctly here
                IsClosed = from q in....
            };


            return(quiz);
        }
    }
}
Esempio n. 6
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var shape = efContainer as EntityTypeShape;

            if (shape != null)
            {
                _entityTypeShapes.Remove(shape);
            }

            var associationConnector = efContainer as AssociationConnector;

            if (associationConnector != null)
            {
                _associationConnectors.Remove(associationConnector);
            }

            var inheritanceConnector = efContainer as InheritanceConnector;

            if (inheritanceConnector != null)
            {
                _inheritanceConnectors.Remove(inheritanceConnector);
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 7
0
 /// <summary>
 ///     Add item to a bucket. On Post invoke, the item in the collection will be re-normalized.
 /// </summary>
 /// <param name="item"></param>
 private void AddToBeNormalizedEFContainerItem(EFContainer item)
 {
     if (!_efContainerToBeNormalized.Contains(item))
     {
         _efContainerToBeNormalized.Add(item);
     }
 }
Esempio n. 8
0
 private static void RecursivelyReplaceStorageNamespaceRefs(
     EFContainer target, string oldStorageNamespace, string newStorageNamespace)
 {
     foreach (var child in target.Children)
     {
         var childAsEFContainer = child as EFContainer;
         var childAsItemBinding = child as ItemBinding;
         if (null != childAsEFContainer)
         {
             RecursivelyReplaceStorageNamespaceRefs(childAsEFContainer, oldStorageNamespace, newStorageNamespace);
         }
         else if (null != childAsItemBinding)
         {
             // if childAsItemBinding startsWith oldStorageNamespace then will update
             // (Note: need to check this because SingleItemBinding<Parameter> will have
             // a NormalizedName which could have this namespace but the reference is solely
             // to the parameterName and so no replacement needs to be made)
             var refName = childAsItemBinding.RefName;
             if (null != refName &&
                 refName.StartsWith(oldStorageNamespace, StringComparison.CurrentCulture))
             {
                 childAsItemBinding.UpdateRefNameNamespaces(oldStorageNamespace, newStorageNamespace);
             }
         }
     }
 }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer is Documentation)
            {
                _documentation = null;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 10
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer is DesignerInfoPropertySet)
            {
                _propertySet = null;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 11
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer is Documentation)
            {
                _documentation = null;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 12
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer is DesignerInfoPropertySet)
            {
                _propertySet = null;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 13
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer == _onDeteleAction)
            {
                _onDeteleAction = null;
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 14
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var point = efContainer as ConnectorPoint;

            if (point != null)
            {
                _connectorPoints.Remove(point);
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 15
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var diagram = efContainer as Diagram;

            if (diagram != null)
            {
                _diagrams.Remove(diagram);
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 16
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child2 = efContainer as NavigationProperty;

            if (child2 != null)
            {
                _navigationProperties.Remove(child2);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 17
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as FunctionImport;

            if (child != null)
            {
                _functionImports.Remove(child);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 18
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as DefiningQuery;

            if (child != null)
            {
                _definingQuery = null;
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 19
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as EnumTypeMember;

            if (child != null)
            {
                _members.Remove(child);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 20
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as EntityTypeMapping;

            if (child1 != null)
            {
                _entityTypeMappings.Remove(child1);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 21
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var sp = efContainer as FunctionImportScalarProperty;

            if (sp != null)
            {
                _scalarProperties.Remove(sp);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 22
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as Parameter;

            if (child1 != null)
            {
                _parameters.Remove(child1);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 23
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var fitm = efContainer as FunctionImportTypeMapping;

            if (fitm != null)
            {
                _typeMappings.Remove(fitm);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 24
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as AssociationSetEnd;

            if (child != null)
            {
                _ends.Remove(child);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 25
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as Property;

            if (child != null)
            {
                _properties.Remove(child);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 26
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer is Summary)
            {
                _summary = null;
            }
            else if (efContainer is LongDescription)
            {
                _longDescription = null;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 27
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer is Summary)
            {
                _summary = null;
            }
            else if (efContainer is LongDescription)
            {
                _longDescription = null;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 28
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var rm = efContainer as ResultMapping;

            if (rm != null)
            {
                Debug.Assert(_resultMapping == rm, "Unknown ResultMapping in OnChildDeleted");
                ClearEFObject(_resultMapping);
                _resultMapping = null;
            }
            else
            {
                base.OnChildDeleted(efContainer);
            }
        }
Esempio n. 29
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer == _principal)
            {
                _principal = null;
                return;
            }

            if (efContainer == _dependent)
            {
                _dependent = null;
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 30
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as AssociationEnd;

            if (child != null)
            {
                _ends.Remove(child);
                return;
            }

            if (efContainer == _referentialConstraint)
            {
                _referentialConstraint = null;
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 31
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as MappingFragment;

            if (child1 != null)
            {
                _fragments.Remove(child1);
                return;
            }

            if (efContainer == _modificationFunctionMapping)
            {
                _modificationFunctionMapping = null;
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 32
0
        internal static void NormalizeAndResolve(EFContainer efContainer)
        {
            if (efContainer == null)
            {
                return;
            }

            // revert this item and its children to the Parsed State, if we don't do this
            // then they will be skipped by the other visitors. Also Unbind so resolving will
            // rebind any references.
            var stateChangingVisitor = new StateChangingVisitor(EFElementState.Parsed);
            stateChangingVisitor.Traverse(efContainer);
            var unbindingVisitor = new UnbindingVisitor();
            unbindingVisitor.Traverse(efContainer);

            ModelManager.NormalizeItem(efContainer);
            efContainer.Artifact.ModelManager.ResolveItem(efContainer);
        }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child2 = efContainer as DesignerProperty;
            if (child2 != null)
            {
                var propEnum = _designerProperties.GetEnumerator();
                while (propEnum.MoveNext())
                {
                    if (propEnum.Current.Value == child2)
                    {
                        _designerProperties.Remove(propEnum.Current.Key);
                        break;
                    }
                }
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 34
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child2 = efContainer as DesignerProperty;

            if (child2 != null)
            {
                var propEnum = _designerProperties.GetEnumerator();
                while (propEnum.MoveNext())
                {
                    if (propEnum.Current.Value == child2)
                    {
                        _designerProperties.Remove(propEnum.Current.Key);
                        break;
                    }
                }
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 35
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as EndProperty;

            if (child1 != null)
            {
                _endProperties.Remove(child1);
                return;
            }

            var child2 = efContainer as Condition;

            if (child2 != null)
            {
                _conditions.Remove(child2);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer == _deleteFunction)
            {
                _deleteFunction = null;
                return;
            }

            if (efContainer == _insertFunction)
            {
                _insertFunction = null;
                return;
            }

            if (efContainer == _updateFunction)
            {
                _updateFunction = null;
                return;
            }

            base.OnChildDeleted(efContainer);
        }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            if (efContainer == _designerInfoRoot)
            {
                _designerInfoRoot = null;
            }
            else if (efContainer == _mappingModel)
            {
                _mappingModel = null;
            }
            else if (efContainer == _conceptualEntityModel)
            {
                _conceptualEntityModel = null;
            }
            else if (efContainer == _storageEntityModel)
            {
                _storageEntityModel = null;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 38
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var fitm = efContainer as FunctionImportTypeMapping;
            if (fitm != null)
            {
                _typeMappings.Remove(fitm);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 39
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as ScalarProperty;
            if (child1 != null)
            {
                _properties.Remove(child1);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
 protected EFNormalizableItem(EFContainer parent, XElement element)
     : base(parent, element)
 {
 }
Esempio n. 41
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as EntityTypeMapping;
            if (child1 != null)
            {
                _entityTypeMappings.Remove(child1);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 42
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var diagram = efContainer as Diagram;
            if (diagram != null)
            {
                _diagrams.Remove(diagram);
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 43
0
 internal TextNode(EFContainer parent, XElement element)
     : base(parent, element)
 {
 }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as FunctionImport;
            if (child != null)
            {
                _functionImports.Remove(child);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as EntitySet;
            if (child1 != null)
            {
                _entitySets.Remove(child1);
                return;
            }

            var child2 = efContainer as AssociationSet;
            if (child2 != null)
            {
                _associationSets.Remove(child2);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
 private void RemoveChildrenOfNewDeleted(EFContainer item)
 {
     // first check to ensure that we have been sent an EFContainer
     if (item != null)
     {
         // check all children of this item, the list of items to delete could contain 
         // a number of siblings, so we need to check every child at any given level
         foreach (var child in item.Children)
         {
             if (_itemsToDelete.Contains(child))
             {
                 // remove this child item, don't need to recurse any further
                 _itemsToDelete.Remove(child);
             }
             else
             {
                 // only recurse further if we didn't remove this child
                 RemoveChildrenOfNewDeleted(child as EFContainer);
             }
         }
     }
 }
Esempio n. 47
0
 internal Summary(EFContainer parent, XElement element)
     : base(parent, element)
 {
 }
Esempio n. 48
0
        /// <summary>
        ///     Asks the passed in item and all its children to resolve references to other
        ///     EFElements across the entire model, i.e., a ScalarProperty will link up to its
        ///     entity and storage properties.
        /// </summary>
        internal void ResolveItem(EFContainer item)
        {
            lock (this)
            {
                var visitor = new ResolvingVisitor(item.Artifact.ArtifactSet);

                var lastMissedCount = visitor.MissedCount;

                while (visitor.MissedCount != 0)
                {
                    visitor.ResetMissedCount();
                    visitor.Traverse(item);

                    // if we can't resolve any more then we are done
                    if (lastMissedCount == visitor.MissedCount)
                    {
                        break;
                    }

                    lastMissedCount = visitor.MissedCount;
                }
            }
        }
Esempio n. 49
0
        /// <summary>
        ///     Asks the passed in item all of its children to create its normalized name
        ///     and load that into the global symbol table.
        /// </summary>
        internal static void NormalizeItem(EFContainer item)
        {
            var visitor = new NormalizingVisitor();

            var lastMissedCount = -1;
            while (visitor.MissedCount != 0)
            {
                visitor.ResetMissedCount();
                visitor.Traverse(item);

                // every item should be able to normalize
                if (lastMissedCount == visitor.MissedCount)
                {
                    // subsequent passes didn't normalize any new items
                    throw new InvalidDataException();
                }

                lastMissedCount = visitor.MissedCount;
            }
        }
 internal ReferentialConstraintRole(EFContainer parent, XElement element)
     : base(parent, element)
 {
 }
Esempio n. 51
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as AssociationEnd;
            if (child != null)
            {
                _ends.Remove(child);
                return;
            }

            if (efContainer == _referentialConstraint)
            {
                _referentialConstraint = null;
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 52
0
 /// <summary>
 ///     Find an EFObject given a delimited name identifier. For example,
 ///     to find the property 'SomeProperty' within the EntityType 'SomeEntity',
 ///     the delimitedNameIdentifier will be 'SomeProperty.SomeEntity' and the
 ///     startingObject will be the artifact
 /// </summary>
 /// <param name="delimitedNameIdentifier"></param>
 /// <returns></returns>
 internal static EFNameableItem FindNameableItemViaIdentifier(EFContainer excludedAncestor, string delimitedNameIdentifier)
 {
     var ids = new Queue<string>(delimitedNameIdentifier.Split('.'));
     return FindNameableItemViaIdentifierInternal(excludedAncestor, ids);
 }
Esempio n. 53
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as AssociationSetEnd;
            if (child != null)
            {
                _ends.Remove(child);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
Esempio n. 54
0
        private static EFNameableItem FindNameableItemViaIdentifierInternal(EFContainer currentContainer, Queue<string> nameQueue)
        {
            if (currentContainer != null)
            {
                var namePart = nameQueue.Dequeue();
                foreach (var childObject in currentContainer.Children.OfType<EFObject>())
                {
                    var nameableItem = childObject as EFNameableItem;
                    var itemBinding = childObject as ItemBinding;
                    var foundNamePartMatch = false;

                    // first examine the name. We can use the name as the type or the actual name.
                    if (namePart.StartsWith("*", StringComparison.Ordinal)
                        && namePart.EndsWith("*", StringComparison.Ordinal))
                    {
                        var trimmedNamePart = namePart.Trim('*');
                        if (itemBinding != null
                            && itemBinding.ResolvedTargets.FirstOrDefault() != null
                            &&
                            itemBinding.ResolvedTargets.FirstOrDefault().GetType().Name == trimmedNamePart)
                        {
                            foundNamePartMatch = true;
                            nameableItem = itemBinding.ResolvedTargets.FirstOrDefault() as EFNameableItem;
                        }
                    }
                    else if (nameableItem != null
                             && nameableItem.LocalName.Value.Equals(namePart, StringComparison.CurrentCulture))
                    {
                        foundNamePartMatch = true;
                    }

                    // if we have found a match, either recurse if there are more names or return this one.
                    if (foundNamePartMatch)
                    {
                        if (nameQueue.Count > 0)
                        {
                            return FindNameableItemViaIdentifierInternal(nameableItem, nameQueue);
                        }
                        else
                        {
                            return nameableItem;
                        }
                    }
                }
            }
            return null;
        }
Esempio n. 55
0
 protected override void OnChildDeleted(EFContainer efContainer)
 {
     if (efContainer == _designerInfoRoot)
     {
         _designerInfoRoot = null;
     }
 }
Esempio n. 56
0
        internal static bool IsUniqueNameInsideContainer(
            EFContainer container, string proposedName, bool uniquenessIsCaseSensitive, HashSet<EFObject> childEFObjectsToIgnore = null)
        {
            if (string.IsNullOrEmpty(proposedName)
                ||
                container == null)
            {
                return false;
            }

            var isUniqueName = true;

            var comparisonType =
                uniquenessIsCaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
            foreach (var child in container.Children)
            {
                var nameableChild = child as EFNameableItem;
                if (nameableChild != null
                    &&
                    (childEFObjectsToIgnore != null ? !childEFObjectsToIgnore.Contains(nameableChild) : true))
                {
                    if (nameableChild.LocalName.Value.Equals(proposedName, comparisonType))
                    {
                        isUniqueName = false;
                        break;
                    }
                }
            }

            return isUniqueName;
        }
Esempio n. 57
0
 protected override void OnChildDeleted(EFContainer efContainer)
 {
     Debug.Fail("This node does not have any children");
 }
Esempio n. 58
0
 internal LongDescription(EFContainer parent, XElement element)
     : base(parent, element)
 {
 }
Esempio n. 59
0
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child = efContainer as EnumTypeMember;
            if (child != null)
            {
                _members.Remove(child);
                return;
            }

            base.OnChildDeleted(efContainer);
        }
        protected override void OnChildDeleted(EFContainer efContainer)
        {
            var child1 = efContainer as EndProperty;
            if (child1 != null)
            {
                _endProperties.Remove(child1);
                return;
            }

            var child2 = efContainer as Condition;
            if (child2 != null)
            {
                _conditions.Remove(child2);
                return;
            }

            base.OnChildDeleted(efContainer);
        }