Beispiel #1
0
        private void BuildOutput()
        {
            var outputType = Properties[MongoDBMapReduceShared.Names.OutputType].GetValue <ITypeReference>();

            if (outputType == null)
            {
                Output = null;
            }
            else
            {
                Output = (ReturnOptionsValue == MongoDBMapReduceShared.ReturnModeType.ListOfRows) ? TypeReference.CreateList(outputType) : outputType;
            }

            if ((ReturnOptionsValue == MongoDBMapReduceShared.ReturnModeType.RowByRow))
            {
                if ((ExecutionPaths.Count == 0) || (!ExecutionPaths.Contains(MongoDBMapReduceShared.Names.ExecutionPath)))
                {
                    ExecutionPaths.Clear();
                    ExecutionPaths.Add(MongoDBMapReduceShared.Names.ExecutionPath, MongoDBMapReduceShared.Names.ExecutionPath, Output, IterationHint.ZeroOrMore);
                }
                else
                {
                    ExecutionPaths[MongoDBMapReduceShared.Names.ExecutionPath].Output = Output;
                }
                Output = null;
            }
            else
            {
                ExecutionPaths.Clear();
            }
        }
Beispiel #2
0
        public override IFunctionData GetFunctionData()
        {
            var data = new FunctionData();

            if (ExecutionPaths.Any())
            {
                data.ExecutionPaths.AddRange(ExecutionPaths);
            }
            data.Output  = Output;
            data.Version = Version;
            data.Properties.AddRange(Properties.Where(prop => prop.IsVisible));
            return(data);
        }
Beispiel #3
0
        public override bool TryGetDataForTypeReference <T>(ITypeReference typeReference, out T data)
        {
            if (!typeReference.Equals(ExecutionPaths.Single().Output))
            {
                return(base.TryGetDataForTypeReference <T>(typeReference, out data));
            }

            if (typeof(T) != typeof(ITransactionDesignerData))
            {
                throw new ArgumentException(string.Format("Invalid data type: {0}.", typeof(T)));
            }

            data = (T)(object)new TransactionDesignerData(this);
            return(true);
        }
Beispiel #4
0
        public FileOpenDesigner(IDesignerContext context)
            : base(context)
        {
            Version = FunctionUpdater.Instance.CurrentVersion;

            Properties.Add(new Property(FileOpenShared.FilePathPropertyName, typeof(string), ValueUseOption.RuntimeRead, null));
            Properties.Add(new Property(FileOpenShared.IsTextPropertyName, typeof(bool), ValueUseOption.DesignTime, true));
            Properties.Add(new Property(FileOpenShared.CodepagePropertyName, typeof(TextCodepage), ValueUseOption.DesignTime, TextCodepage.Default));
            Properties.Add(new Property(FileOpenShared.FileDoesNotExistPropertyName, typeof(DoesNotExistOptions), ValueUseOption.DesignTime, DoesNotExistOptions.CreateFile));
            Properties.Add(new Property(FileOpenShared.FileExistsPropertyName, typeof(ExistOptions), ValueUseOption.DesignTime, ExistOptions.AppendData));
            SetPropertyAttributes();

            ExecutionPaths.Add(FileOpenShared.ExecutionPathName, FileOpenShared.ExecutionPathName, BuildExecutionPathOutput(), IterationHint.Once);
            Output = TypeReference.Create(typeof(string));
        }
Beispiel #5
0
        public BeginTransactionDesigner(IDesignerContext context) : base(context)
        {
            Properties[DbShared.ConnectionTypePropertyName].IsVisible = false;
            Properties.Add(new Property(BeginTransactionShared.ConnectionTypePropertyName, typeof(ConnectionType), ValueUseOption.DesignTime, ConnectionType.SqlServer));

            Properties.Add(new Property(BeginTransactionShared.SqlServerIsolationLevelPropertyName, typeof(SqlServerIsolationLevel), ValueUseOption.DesignTime, SqlServerIsolationLevel.ReadCommitted));
            Properties.Add(new Property(BeginTransactionShared.OracleIsolationLevelPropertyName, typeof(OracleIsolationLevel), ValueUseOption.DesignTime, OracleIsolationLevel.ReadCommitted));
            Properties.Add(new Property(BeginTransactionShared.OleDbIsolationLevelPropertyName, typeof(OleDbIsolationLevel), ValueUseOption.DesignTime, OleDbIsolationLevel.ReadCommitted));
            Properties.Add(new Property(BeginTransactionShared.OdbcIsolationLevelPropertyName, typeof(OdbcIsolationLevel), ValueUseOption.DesignTime, OdbcIsolationLevel.ReadCommitted));
            SetPropertyAttributes();

            var output = TypeReference.CreateResource(typeof(Transaction));

            ExecutionPaths.Add(BeginTransactionShared.ExecutionPathName, BeginTransactionShared.ExecutionPathName, output, IterationHint.Once);
        }
Beispiel #6
0
        private void BuildSplitOutput()
        {
            var outputBuilder = new TypeBuilder();

            bool loopResultsValue = Properties[PropertyNames.SplitLoopResults].GetValue <bool>();

            if (loopResultsValue)
            {
                ExecutionPaths.Add(ExecutionPathNames.PageFiles, ExecutionPathNames.PageFiles, TypeReference.Create(typeof(string)));
            }
            else
            {
                outputBuilder.AddProperty(OutputNames.PageFiles, TypeReference.CreateList(typeof(string)));
            }

            outputBuilder.AddProperty(OutputNames.NumberOfPages, typeof(int));
            Output = outputBuilder.CreateTypeReference();
        }
Beispiel #7
0
        private void BuildDataOut()
        {
            if (Properties[FileListShared.LoopResultsPropertyName].GetValue <bool>())
            {
                Output = TypeReference.CreateGeneratedType(new TypeProperty(FileListShared.OutputNumberOfFilesName, typeof(Int32)));

                if (!ExecutionPaths.Any())
                {
                    ExecutionPaths.Add(FileListShared.OutputFileProperty, FileListShared.OutputFileProperty, CreateFileInfoType(), IterationHint.ZeroOrMore);
                }
            }
            else
            {
                ExecutionPaths.Clear();

                Output = TypeReference.CreateGeneratedType(
                    new TypeProperty(FileListShared.OutputFileInfoName, TypeReference.CreateList(CreateFileInfoType())),
                    new TypeProperty(FileListShared.OutputNumberOfFilesName, typeof(Int32)));
            }
        }
Beispiel #8
0
 private void BuildExecutionPaths()
 {
     if ((ResultTypeValue.Fields.Count != 0) && (ReturnOptionsValue == ExecuteSQLShared.ReturnModeType.RowByRow))
     {
         if ((ExecutionPaths.Count == 0) || (!ExecutionPaths.Contains(ExecuteSQLShared.ExecutionPathName)))
         {
             ExecutionPaths.Clear();
             ExecutionPaths.Add(ExecuteSQLShared.ExecutionPathName, ExecuteSQLShared.ExecutionPathName, Output, IterationHint.ZeroOrMore);
         }
         else
         {
             ExecutionPaths[ExecuteSQLShared.ExecutionPathName].Output = Output;
         }
         Output = null;
     }
     else
     {
         ExecutionPaths.Clear();
     }
 }
Beispiel #9
0
        private void RefreshExecutionPaths()
        {
            if (OutputOption == OutputOption.RowByRow)
            {
                for (int i = 0; i < ResultSetCount; i++)
                {
                    ITypeReference outputType = BuildResultSetTypeReference(ResultSetCollection[i]);

                    string executionPathKey  = string.Format(ExecuteStoredProcedureShared.ResultSetExecutionPathNameFormat, i + 1);
                    string executionPathName = ResultSetCount == 1 ? string.Format(ExecuteStoredProcedureShared.ResultSetExecutionPathNameFormat, string.Empty) : executionPathKey;
                    if (ExecutionPaths.Contains(executionPathKey))
                    {
                        ExecutionPath executionPath = ExecutionPaths[executionPathKey];
                        executionPath.Name          = executionPathName;
                        executionPath.Output        = outputType;
                        executionPath.IterationHint = IterationHint.ZeroOrMore;
                    }
                    else
                    {
                        ExecutionPaths.Add(executionPathKey, executionPathName, outputType, IterationHint.ZeroOrMore);
                    }
                }

                for (int i = ResultSetCount; ; i++)
                {
                    string executionPathKey = string.Format(ExecuteStoredProcedureShared.ResultSetExecutionPathNameFormat, i + 1);
                    if (ExecutionPaths.Contains(executionPathKey))
                    {
                        ExecutionPaths.Remove(executionPathKey);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else
            {
                ExecutionPaths.Clear();
            }
        }
Beispiel #10
0
 private void BuildExecutionPaths()
 {
     if (ReadType == FileReadOptions.LineByLine)
     {
         TypeBuilder typeBuilder = new TypeBuilder();
         typeBuilder.AddProperty(TextFileReadShared.LineNumberName, typeof(int));
         typeBuilder.AddProperty(TextFileReadShared.LineContentsName, Fields.FieldList.Any() ? Fields.CreateTypeReference() : TypeReference.Create(typeof(string)));
         GeneratedTypeReference outputType = typeBuilder.CreateTypeReference();
         if (ExecutionPaths.Contains(TextFileReadShared.ExecutionPathName))
         {
             ExecutionPaths[TextFileReadShared.ExecutionPathName].Output = outputType;
         }
         else
         {
             ExecutionPaths.Add(TextFileReadShared.ExecutionPathName, TextFileReadShared.ExecutionPathName, outputType, IterationHint.ZeroOrMore);
         }
     }
     else
     {
         ExecutionPaths.Clear();
     }
 }
Beispiel #11
0
        private void BuildOutput()
        {
            Output = null;
            ExecutionPaths.Clear();

            Operation operationValue = Properties[PropertyNames.Operation].GetValue <Operation>();

            switch (operationValue)
            {
            case Operation.FillForm:
            case Operation.Protect:
            case Operation.Concatenate:
            case Operation.AddWatermark:
            case Operation.Sign:
                break;

            case Operation.Split:
                BuildSplitOutput();
                break;

            default:
                throw new Exception("Invalid Operation specified.");
            }
        }
Beispiel #12
0
        private void RefreshExecutionPath()
        {
            var columns = Properties[DbBulkCopyShared.ColumnsPropertyName].GetValue <DatabaseModel.Columns>();

            if (columns.Any())
            {
                TypeReference outputTypeReference = new DynamicCompiledTypeReference(typeof(Loader), _ =>
                {
                    var rowTypeBuilder = new TypeBuilder();
                    foreach (var nextColumn in columns)
                    {
                        Type systemType             = nextColumn.DataType.GetSystemType();
                        bool isNullableType         = systemType.IsClass;
                        ITypeReference propertyType = isNullableType ? systemType.MapType() : TypeReference.Create(typeof(Nullable <>).MakeGenericType(systemType));

                        rowTypeBuilder.AddProperty(
                            DbBulkCopyShared.GetPropertyName(nextColumn.Name),
                            propertyType);
                    }
                    return(rowTypeBuilder.CreateTypeReference());
                });

                if (ExecutionPaths.Any())
                {
                    ExecutionPaths[DbBulkCopyShared.ExecutionPathName].Output = outputTypeReference;
                }
                else
                {
                    ExecutionPaths.Add(DbBulkCopyShared.ExecutionPathName, DbBulkCopyShared.ExecutionPathName, outputTypeReference, IterationHint.Once);
                }
            }
            else if (ExecutionPaths.Any())
            {
                ExecutionPaths.Clear();
            }
        }
Beispiel #13
0
        public static bool TryCommand(string Data)
        {
            string[] FullCommandWithArguments;
            FullCommandWithArguments = Data.Split(null);

            switch (FullCommandWithArguments[0])
            {
            case "about":
                About.Command();
                return(true);

            case "%execution.path%":
                ExecutionPaths.Command();
                return(true);

            case "copy":
                FileCopy.Command(FullCommandWithArguments);
                return(true);

            case "exit":
                Exit.Command(FullCommandWithArguments);
                return(true);

            case "stacktolog":
                StackToLog.Command();
                return(true);

            case "vars":
                Vars.Command(FullCommandWithArguments);
                return(true);

            case "clear":
                ClearScreen.Command();
                return(true);

            case "lastcommand":
                LastCommand.Command();
                return(true);

            case "cd":
                Cd.Command(FullCommandWithArguments);
                return(true);

            case "collectgarbage":
                Functions.AppOnlyScope.Disposal.RunCleanup();
                return(true);

            case "ls":
                Ls.Command(FullCommandWithArguments);
                return(true);

            case "ping":
                Ping.Command(FullCommandWithArguments);
                return(true);

            case "ipinfo":
                IpInfo.Command(FullCommandWithArguments);
                return(true);

            case "commands":
                CommandList.Command();
                return(true);

            case "help":
                CommandList.Command();
                return(true);

            case "download":
                Download.Command(FullCommandWithArguments);
                return(true);

            case "start":
                Run.Command(FullCommandWithArguments);
                return(true);

            case "run":
                Run.Command(FullCommandWithArguments);
                return(true);

            default:
                return(false);
            }
        }