Exemplo n.º 1
0
        /// <summary>
        ///     We override this method to do some specialized processing of FunctionImport antiDeps
        /// </summary>
        /// <param name="cpc"></param>
        protected override void RemoveAntiDeps(CommandProcessorContext cpc)
        {
            var cModel = EFElement.RuntimeModelRoot() as ConceptualEntityModel;

            if (cModel != null)
            {
                // If there is a FunctionImport which returns a complex type, set the FunctionImport return type to null.
                foreach (var fi in EFElement.GetAntiDependenciesOfType <FunctionImport>())
                {
                    CommandProcessor.InvokeSingleCommand(
                        cpc, new ChangeFunctionImportCommand(
                            cModel.FirstEntityContainer as ConceptualEntityContainer,
                            fi, fi.Function, fi.DisplayName, fi.IsComposable.Value, true,
                            Resources.NoneDisplayValueUsedForUX));
                }
            }

            // process the remaining antiDeps normally
            base.RemoveAntiDeps(cpc);
        }
Exemplo n.º 2
0
        internal static EntityDesignerSelection?DetermineEntityDesignerSelection(EFElement el)
        {
            var isConceptual = el.RuntimeModelRoot() is ConceptualEntityModel;

            if (el.EFTypeName == BaseEntityModel.ElementName)
            {
                if (el is ConceptualEntityModel)
                {
                    return(EntityDesignerSelection.DesignerSurface);
                }
                else
                {
                    return(EntityDesignerSelection.StorageModelEntityContainer);
                }
            }
            else if (el.EFTypeName == EntitySet.ElementName && isConceptual)
            {
                return(EntityDesignerSelection.ConceptualModelEntitySet);
            }
            else if (el.EFTypeName == AssociationSet.ElementName && isConceptual)
            {
                return(EntityDesignerSelection.ConceptualModelAssociationSet);
            }
            else if (el.EFTypeName == BaseEntityContainer.ElementName)
            {
                if (isConceptual)
                {
                    return(EntityDesignerSelection.ConceptualModelEntityContainer);
                }
                else
                {
                    return(EntityDesignerSelection.StorageModelEntityContainer);
                }
            }
            else if (el.EFTypeName == EntityType.ElementName)
            {
                if (isConceptual)
                {
                    return(EntityDesignerSelection.ConceptualModelEntityType);
                }
                else
                {
                    return(EntityDesignerSelection.StorageModelEntityType);
                }
            }
            else if (el.EFTypeName == Property.ElementName)
            {
                if (isConceptual)
                {
                    if (el is ComplexConceptualProperty)
                    {
                        return(EntityDesignerSelection.ConceptualModelComplexProperty);
                    }
                    else
                    {
                        return(EntityDesignerSelection.ConceptualModelProperty);
                    }
                }
                else
                {
                    return(EntityDesignerSelection.StorageModelProperty);
                }
            }
            else if (el.EFTypeName == NavigationProperty.ElementName)
            {
                return(EntityDesignerSelection.ConceptualModelNavigationProperty);
            }
            else if (el.EFTypeName == Association.ElementName)
            {
                if (isConceptual)
                {
                    return(EntityDesignerSelection.ConceptualModelAssociation);
                }
                else
                {
                    return(EntityDesignerSelection.StorageModelAssociation);
                }
            }
            else if (el.EFTypeName == ComplexType.ElementName && isConceptual)
            {
                return(EntityDesignerSelection.ConceptualModelComplexType);
            }
            else if (el.EFTypeName == FunctionImport.ElementName)
            {
                return(EntityDesignerSelection.ConceptualModelFunctionImport);
            }
            else if (el.EFTypeName == Parameter.ElementName)
            {
                if (isConceptual)
                {
                    return(EntityDesignerSelection.ConceptualModelFunctionImportParameter);
                }
                else
                {
                    return(EntityDesignerSelection.StorageModelFunctionParameter);
                }
            }
            else if (el.EFTypeName == Function.ElementName)
            {
                return(EntityDesignerSelection.StorageModelFunction);
            }
            else if (el.EFTypeName == EntityTypeShape.ElementName)
            {
                return(EntityDesignerSelection.ConceptualModelEntityType);
            }

            return(null);
        }