public void InitializeAssemblies_BuildsMaps() { MappingRepoDictionary.InitializeAssemblies(GetType().Assembly); var map = MappingRepoDictionary.GetMap <SimpleObject>(); Assert.IsNotNull(map); }
private static string CreateMessage(string sql, IList <object> parameters, IDataReader reader, IDbConnection connection) { #if NETSTANDARD1_4 return(".Net standard does not support schema investigation. Once it will, this code will be revised"); #else var mapping = MappingRepoDictionary.GetMappedTypes(); var schema = reader.GetSchemaTable(); var rows = schema?.Rows; var tableName = string.Empty; var schemaName = string.Empty; var columnNameIndex = 0; var schemaIndex = 9; var tableNameIndex = 10; var typeIndex = 11; var columns = new List <string>(); if (rows != null && schema.Columns.Count > 11) { foreach (DataRow row in rows) { columns.Add($"{row.ItemArray[columnNameIndex]} + type: {row.ItemArray[typeIndex]}"); } tableName = rows[0][tableNameIndex].ToString(); schemaName = rows[0][schemaIndex].ToString(); } var mappedNames = mapping.Select(x => x.Name).OrderBy(x => x).ToArray(); var mapsMessage = MappingRepoDictionary.GetMap <T>().ToString(); var mappingMessage = string.Join(",", mappedNames); var schemaMessage = $"Table name: {tableName}, Schema Name: {schemaName}"; if (columns.Any()) { schemaMessage += $", ColumnsNames: {string.Join(",", columns)}"; } return($"\r\nT: {typeof(T).Name},\r\n T-Maps: {mapsMessage},\r\n SQL: {sql},\r\n Parameters: {string.Join(",", parameters)},\r\n Mapping: {mappingMessage},\r\n Schema: {schemaMessage} \r\n ConnectionString: {connection?.ConnectionString}"); #endif }