コード例 #1
0
        private void InitConnection()
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00);
            connectionCollection = new List <JsonDataSourceConnection>();
            JsonDataSourceConnection jsonData;
            int countRec;

            sourceConnectionStringBuilder = new ESDataSourceConnectionStringBuilder(ConnectionString);
            tableNames = GetTableNames();

            foreach (var tableName in tableNames)
            {
                countRec = GetRecCount(tableName);
                JsonDataSourceConnectionStringBuilder connectionStringBuilder = new JsonDataSourceConnectionStringBuilder();
                connectionStringBuilder.ConnectionString =
                    $"Json={sourceConnectionStringBuilder.EndPoint}/{tableName}/_search?size={countRec};JsonShema=;Encoding=utf-8;";
                connectionStringBuilder.Headers = sourceConnectionStringBuilder.Headers;
                jsonData = new JsonDataSourceConnection()
                {
                    ConnectionString = connectionStringBuilder.ToString()
                };
                connectionCollection.Add(jsonData);
            }
        }
コード例 #2
0
        public JsonDataSourceConnection GetParentJTDSByName(string name)
        {
            sourceConnectionStringBuilder = new ESDataSourceConnectionStringBuilder(ConnectionString);

            if (tableNames == null)
            {
                tableNames = GetTableNames();
            }
            if (tableNames == null || !tableNames.Contains(name))
            {
                return(null);
            }

            int countRec = GetRecCount(name);
            JsonDataSourceConnectionStringBuilder connectionStringBuilder = new JsonDataSourceConnectionStringBuilder();

            connectionStringBuilder.ConnectionString =
                $"Json={sourceConnectionStringBuilder.EndPoint}/{name}/_search?size={countRec};JsonShema=;Encoding=utf-8;";
            connectionStringBuilder.Headers = sourceConnectionStringBuilder.Headers;
            return(new JsonDataSourceConnection()
            {
                ConnectionString = connectionStringBuilder.ToString()
            });
        }