예제 #1
0
        internal KustoDataService()
        {
            KustoConnectionStringBuilder kcsb = new KustoConnectionStringBuilder($"https://ingest-{ServiceNameAndRegion}.kusto.windows.net")
                                                .WithAadManagedIdentity("system");

            DirectJsonMappingResolver directJsonMappingResolver = new DirectJsonMappingResolver();

            _httpRequestLogsTable     = new KustoTable <HttpRequestLogEntry>(kcsb, DatabaseName, "UrlAccessLogs", directJsonMappingResolver);
            _scriptExecutionLogsTable = new KustoTable <ScriptExecutionLogEntry>(kcsb, DatabaseName, "ScriptExecLogs", directJsonMappingResolver);
        }
예제 #2
0
        /// <summary>
        /// Compares the given column names with the column names generated by <see cref="DirectJsonMappingResolver"/>
        /// for the given type.
        /// </summary>
        /// <typeparam name="T">Data class whose column names will be resolved by <see cref="DirectJsonMappingResolver"/></typeparam>
        /// <param name="expectedColumnNames">Column names to compare. Order of the items is unimportant.</param>
        private void CompareMappings <T>(string[] expectedColumnNames) where T : IKustoTableRow
        {
            DirectJsonMappingResolver   mappingResolver   = new DirectJsonMappingResolver();
            IEnumerable <ColumnMapping> mappingCollection = mappingResolver.GetColumnMappings <T>();

            List <string> mappedColumnNames = mappingCollection.Select(m => m.ColumnName).ToList();

            Assert.IsTrue(!mappedColumnNames.Except(expectedColumnNames).Any(),
                          $"The following columns shouldn't have been mapped, but they were: { string.Join(", ", mappedColumnNames.Except(expectedColumnNames))}");

            Assert.IsTrue(!expectedColumnNames.Except(mappedColumnNames).Any(),
                          $"The following columns should have been mapped, but they weren't: { string.Join(", ", expectedColumnNames.Except(mappedColumnNames))}");
        }
예제 #3
0
        internal KustoDataService()
        {
            if (string.IsNullOrWhiteSpace(DatabaseName))
            {
                throw new InvalidOperationException($"{nameof(DatabaseName)} was not correctly configured. " +
                                                    "Make sure \"kusto_db_name\" is properly assigned in function app configuration.");
            }

            KustoConnectionStringBuilder kcsb = new KustoConnectionStringBuilder($"https://ingest-{ServiceNameAndRegion}.kusto.windows.net")
                                                .WithAadManagedIdentity("system");

            DirectJsonMappingResolver directJsonMappingResolver = new DirectJsonMappingResolver();

            _httpRequestLogsTable     = new KustoTable <HttpRequestLogEntry>(kcsb, DatabaseName, "UrlAccessLogs", directJsonMappingResolver);
            _scriptExecutionLogsTable = new KustoTable <ScriptExecutionLogEntry>(kcsb, DatabaseName, "ScriptExecLogs", directJsonMappingResolver);
        }