Esempio n. 1
0
        private IFunctionData UpdateToVersion1(IFunctionData data)
        {
            IPropertyData filePathProperty = data.FindPropertyById(FileShared.FilePathPropertyName);
            object        value;

            if (filePathProperty.Value is IExpression)
            {
                value = filePathProperty.Value;
            }
            else if (filePathProperty.Value is string)
            {
                value = (TextFileHandle)filePathProperty.Value.ToString();
            }
            else
            {
                value = filePathProperty.Value;
            }

            return(data
                   .ReplaceProperty(filePathProperty, new Property(FileShared.FilePathPropertyName, typeof(TextFileHandle), ValueUseOption.RuntimeRead, null)
            {
                Value = value
            })
                   .UpdateOutput(TypeReference.Create(typeof(string)))
                   .UpdateVersion("1"));
        }
Esempio n. 2
0
        private IFunctionData UpdateToVersion1(IFunctionData data)
        {
            IPropertyData oldFilePathProperty = data.FindPropertyById("File Path");
            IPropertyData filePathProperty    = data.FindPropertyById(FileShared.FilePathPropertyName);

            IPropertyData propertyToReplace = null;
            object        propertyValue     = null;

            if (filePathProperty != null)
            {
                propertyToReplace = filePathProperty;

                if (filePathProperty.Value is IExpression)
                {
                    propertyValue = filePathProperty.Value;
                }
                else if (filePathProperty.Value is string)
                {
                    propertyValue = (BinaryFileHandle)filePathProperty.Value.ToString();
                }
                else
                {
                    propertyValue = filePathProperty.Value;
                }
            }
            else if (oldFilePathProperty != null)
            {
                propertyToReplace = oldFilePathProperty;

                if (oldFilePathProperty.Value is IExpression)
                {
                    propertyValue = oldFilePathProperty.Value;
                }
                else if (oldFilePathProperty.Value is string)
                {
                    propertyValue = (BinaryFileHandle)oldFilePathProperty.Value.ToString();
                }
                else
                {
                    propertyValue = oldFilePathProperty.Value;
                }
            }

            return(data
                   .ReplaceProperty(propertyToReplace, new Property(FileShared.FilePathPropertyName, typeof(BinaryFileHandle), ValueUseOption.RuntimeRead, null)
            {
                Value = propertyValue
            })
                   .UpdateVersion("1"));
        }
Esempio n. 3
0
        private IFunctionData UpdateToVersion2(IFunctionData data)
        {
            var resultFieldsProperty = data.Properties[ExecuteSQLShared.ResultTypePropertyName];
            var resultType           = new ResultType();

            resultType.Fields.AddRange(resultFieldsProperty.GetValue <ResultTypeFields>());
            data = data.ReplaceProperty(resultFieldsProperty,
                                        new Property(ExecuteSQLShared.ResultTypePropertyName, typeof(ResultType), ValueUseOption.DesignTime, new ResultType())
            {
                Value = resultType
            });

            return(data.UpdateVersion("2"));
        }
Esempio n. 4
0
        private IFunctionData FixProperties(IFunctionData data, IDictionary <string, ITypeReference> executionPathOutputMap)
        {
            foreach (var property in data.Properties.Values.ToArray())
            {
                if (property.Name == DbShared.DesignTimeConnectionTypePropertyName)
                {
                    data = data.ReplaceProperty(property, FixDesignTimeConnectionTypeProperty(property));
                }
                else if (property.Name == DbShared.ConnectionTypePropertyName)
                {
                    data = data.ReplaceProperty(property, FixConnectionTypeProperty(property));
                }
                else if (property.Name == ExecuteStoredProcedureShared.ParametersPropertyName)
                {
                    data = data.ReplaceProperty(property, FixParametersProperty(property));
                }
                else if (executionPathOutputMap.ContainsKey(property.Name))
                {
                    data = data.ReplaceProperty(property, FixResultSetProperty(property, executionPathOutputMap[property.Name]));
                }
            }

            return(data);
        }
Esempio n. 5
0
        private IFunctionData TransformConnectionTypeProperty(IFunctionData data)
        {
            IPropertyData connectionTypeProperty;

            if (data.TryFindPropertyById(DbShared.ConnectionTypePropertyName, out connectionTypeProperty))
            {
                if (connectionTypeProperty.TypeReference.IsCompiled && connectionTypeProperty.TypeReference.GetUnderlyingType() == typeof(ConnectionTypeSelection))
                {
                    return(data);
                }

                var newConnectionTypeProperty = new Property(DbShared.ConnectionTypePropertyName, typeof(ConnectionTypeSelection), ValueUseOption.DesignTime, ConnectionTypeSelection.SqlServer)
                {
                    Value     = connectionTypeProperty.GetValue <ConnectionType>().ToConnectionTypeSelection(),
                    IsVisible = connectionTypeProperty.IsVisible
                };

                data = data.ReplaceProperty(connectionTypeProperty, newConnectionTypeProperty);
            }

            return(data);
        }