Ejemplo n.º 1
0
        /// <summary>
        ///     Returns list of all s-side functions
        /// </summary>
        internal override Dictionary <MappingLovEFElement, string> GetListOfValues(ListOfValuesCollection type)
        {
            var lov = new Dictionary <MappingLovEFElement, string>();

            Debug.Assert(type == ListOfValuesCollection.FirstColumn, "Unsupported lov type was sent");

            if (type == ListOfValuesCollection.FirstColumn)
            {
                var functionImport = FunctionImportMapping.FunctionImportName.Target;
                Debug.Assert(functionImport != null, "Couldn't find FunctionImport binding");
                if (functionImport != null)
                {
                    var storageModel = EFExtensions.StorageModel(functionImport.Artifact);

                    foreach (var function in storageModel.Functions())
                    {
                        // add the Function to the list
                        lov.Add(new MappingLovEFElement(function, function.DisplayName), function.DisplayName);
                    }

                    return(lov);
                }
            }

            return(base.GetListOfValues(type));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Changes the s-side Function in the FunctionImportMapping
        /// </summary>
        internal void ChangeModelItem(EditingContext context, Function newFunction)
        {
            var fi = FunctionImportMapping.FunctionImportName.Target;

            if (fi != null &&
                FunctionImportMapping.FunctionName.Target != newFunction)
            {
                var cModel = EFExtensions.RuntimeModelRoot(FunctionImportMapping.FunctionImportName.Target) as ConceptualEntityModel;
                if (cModel != null)
                {
                    var cmd = new ChangeFunctionImportCommand(
                        cModel.FirstEntityContainer as ConceptualEntityContainer,
                        fi,
                        newFunction,
                        fi.LocalName.Value,
                        fi.IsComposable.Value,
                        false,
                        null);
                    // This command can be called before the provider has been registered with the
                    // resolver (e.g. Mapping Details window on a newly-opened project) - so ensure
                    // provider is registered here before any commands are invoked
                    var cpc = new CommandProcessorContext(
                        context, EfiTransactionOriginator.MappingDetailsOriginatorId, Resources.Tx_ChangeFuncImpMapping);
                    VsUtils.EnsureProvider(cpc.Artifact);
                    CommandProcessor.InvokeSingleCommand(cpc, cmd);
                }
            }
        }
Ejemplo n.º 3
0
        protected override void PopulateMappingForSelectedObject(EFFunctionImportDescriptor selectedObject)
        {
            Debug.Assert(selectedObject != null, "selectedObject should not be null");

            if (selectedObject != null)
            {
                AddMapping(null, Resources.NoneDisplayValueUsedForUX);
                var currentType = selectedObject.WrappedItem as FunctionImport;
                if (currentType != null &&
                    currentType.Artifact != null &&
                    EFExtensions.StorageModel(currentType.Artifact) != null)
                {
                    var functions = EFExtensions.StorageModel(currentType.Artifact).Functions();
                    foreach (var function in functions)
                    {
                        AddMapping(function, function.LocalName.Value);
                    }
                }
            }
        }