예제 #1
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"));
        }
예제 #2
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"));
        }
예제 #3
0
        private IFunctionData AddTransactionProperty(IFunctionData data)
        {
            if (data.FindPropertyById(DbShared.TransactionPropertyName) == null)
            {
                data = data.AddProperty(new Property(DbShared.TransactionPropertyName, typeof(Transaction), ValueUseOption.DesignTime, null));
            }

            return(data);
        }
예제 #4
0
        private IFunctionData AddMissingProperties(IFunctionData data)
        {
            IPropertyData loopResultsProperty;

            if (data.FindPropertyById(MongoDBMapReduceShared.Names.ReturnOptionsPropertyName) == null)
            {
                MongoDBMapReduceShared.ReturnModeType returnModeType = MongoDBMapReduceShared.ReturnModeType.ListOfRows;
                if (data.TryFindPropertyById("LoopResults", out loopResultsProperty))
                {
                    returnModeType = loopResultsProperty.GetValue <bool>() ? MongoDBMapReduceShared.ReturnModeType.RowByRow : MongoDBMapReduceShared.ReturnModeType.ListOfRows;
                    data           = data.RemoveProperty(data.FindPropertyById("LoopResults"));
                }
                data = data.AddProperty(new Property(MongoDBMapReduceShared.Names.ReturnOptionsPropertyName, typeof(MongoDBMapReduceShared.ReturnModeType), ValueUseOption.DesignTime, returnModeType)
                {
                    IsVisible = true
                });
            }

            return(data);
        }
예제 #5
0
        private IFunctionData UpdateToVersion2(IFunctionData data)
        {
            IPropertyData loopResultsProperty;

            if (data.FindPropertyById(MongoDBReadShared.Names.ReturnOptionsPropertyName) == null)
            {
                MongoDBReadShared.ReturnModeType returnModeType = MongoDBReadShared.ReturnModeType.ListOfRows;
                if (data.TryFindPropertyById("LoopResults", out loopResultsProperty))
                {
                    returnModeType = loopResultsProperty.GetValue <bool>() ? MongoDBReadShared.ReturnModeType.RowByRow : MongoDBReadShared.ReturnModeType.ListOfRows;
                    data           = data.RemoveProperty(data.FindPropertyById("LoopResults"));
                }
                data = data.AddProperty(new Property(MongoDBReadShared.Names.ReturnOptionsPropertyName, typeof(MongoDBReadShared.ReturnModeType), ValueUseOption.DesignTime, returnModeType)
                {
                    IsVisible = true
                });
            }

            data = ChangeExecutionPathKey(data);
            return(data.UpdateVersion("2"));
        }
예제 #6
0
        private IFunctionData AddMissingProperties(IFunctionData data)
        {
            var connectionType = ConnectionType.OleDb;

            if (data.Properties[DbShared.ConnectionStringPropertyName].Value is string)
            {
                connectionType = DatabaseAssistant.DetectConnectionType(data.Properties[DbShared.ConnectionStringPropertyName].Value as string) ?? ConnectionType.OleDb;
            }

            if (data.FindPropertyById(DbShared.ConnectionTypePropertyName) == null)
            {
                data = data.AddProperty(new Property(DbShared.ConnectionTypePropertyName, typeof(ConnectionType), ValueUseOption.DesignTime, ConnectionType.SqlServer)
                {
                    Value = connectionType
                });
            }

            if (data.FindPropertyById(DbShared.DesignTimeConnectionTypePropertyName) == null)
            {
                data = data.AddProperty(new Property(DbShared.DesignTimeConnectionTypePropertyName, typeof(ConnectionType), ValueUseOption.DesignTime, ConnectionType.SqlServer)
                {
                    Value     = connectionType,
                    IsVisible = false
                });
            }

            if (data.FindPropertyById(DbShared.DesignTimeConnectionStringPropertyName) == null)
            {
                data = data.AddProperty(new Property(DbShared.DesignTimeConnectionStringPropertyName, typeof(string), ValueUseOption.DesignTime, string.Empty)
                {
                    IsVisible = false
                });
            }

            return(data);
        }
예제 #7
0
        private IFunctionData AddMissingProperties(IFunctionData data)
        {
            IPropertyData criteriaProperty;
            IPropertyData aggregationPipelineProperty;

            object criteria            = string.Empty;
            object aggregationPipeline = string.Empty;

            MongoDBReadShared.OperationType operationType = MongoDBReadShared.OperationType.Find;

            if (data.TryFindPropertyById("Criteria", out criteriaProperty) &&
                data.TryFindPropertyById("Aggregation pipeline", out aggregationPipelineProperty))
            {
                criteria            = criteriaProperty.Value;
                aggregationPipeline = aggregationPipelineProperty.Value;

                if (string.IsNullOrEmpty(criteria.ToString()) && !string.IsNullOrEmpty(aggregationPipeline.ToString()))
                {
                    operationType = MongoDBReadShared.OperationType.Aggregate;
                }
                data = data.RemoveProperty(criteriaProperty);
                data = data.RemoveProperty(aggregationPipelineProperty);
            }

            if (data.FindPropertyById(MongoDBReadShared.Names.Operation) == null)
            {
                data = data.AddProperty(new Property(MongoDBReadShared.Names.Operation, typeof(MongoDBReadShared.OperationType), ValueUseOption.DesignTime, operationType));
            }

            if (data.FindPropertyById(MongoDBReadShared.Names.AggregationPipeline) == null)
            {
                data = data.AddProperty(new Property(MongoDBReadShared.Names.AggregationPipeline, typeof(string), ValueUseOption.RuntimeRead, aggregationPipeline)
                {
                    IsVisible = true
                });
            }

            if (data.FindPropertyById(MongoDBReadShared.Names.Query) == null)
            {
                data = data.AddProperty(new Property(MongoDBReadShared.Names.Query, typeof(string), ValueUseOption.RuntimeRead, criteria)
                {
                    IsVisible = true
                });
            }

            if (data.FindPropertyById(MongoDBReadShared.Names.Fields) == null)
            {
                data = data.AddProperty(new Property(MongoDBReadShared.Names.Fields, typeof(string), ValueUseOption.RuntimeRead, string.Empty)
                {
                    IsVisible = true
                });
            }

            if (data.FindPropertyById(MongoDBReadShared.Names.Sort) == null)
            {
                data = data.AddProperty(new Property(MongoDBReadShared.Names.Sort, typeof(string), ValueUseOption.RuntimeRead, string.Empty)
                {
                    IsVisible = true
                });
            }

            if (data.FindPropertyById(MongoDBReadShared.Names.Skip) == null)
            {
                data = data.AddProperty(new Property(MongoDBReadShared.Names.Skip, typeof(int), ValueUseOption.RuntimeRead, 0)
                {
                    IsVisible = true
                });
            }

            if (data.FindPropertyById(MongoDBReadShared.Names.Limit) == null)
            {
                data = data.AddProperty(new Property(MongoDBReadShared.Names.Limit, typeof(int), ValueUseOption.RuntimeRead, 0)
                {
                    IsVisible = true
                });
            }

            string        criteriaExpressionKey = "CriteriaExpression";
            List <string> criteriaExpressionIDs = data.Properties.Keys.Where(key => key.StartsWith(criteriaExpressionKey)).ToList();

            foreach (string criteriaExpressionID in criteriaExpressionIDs)
            {
                IPropertyData criteriaExpressionProperty = data.Properties[criteriaExpressionID];
                string        queryExpressionName        = criteriaExpressionID.Replace(criteriaExpressionKey, MongoDBReadShared.Names.QueryExpressions);
                data = data.AddProperty(new Property(queryExpressionName, criteriaExpressionProperty.TypeReference, criteriaExpressionProperty.ValueUsage, criteriaExpressionProperty.Value)
                {
                    IsVisible = criteriaExpressionProperty.IsVisible
                });
                data = data.RemoveProperty(criteriaExpressionProperty);
            }

            return(data);
        }