private static MessageTraceEntityBase[] MapResultsTable <T>(DataTable table) where T : MessageTraceEntityBase, new() { List <MessageTraceEntityBase> list = new List <MessageTraceEntityBase>(); if (list != null && table != null && table.Rows.Count > 0) { MessageTraceDataSet.< > c__DisplayClass3 <T> CS$ < > 8__locals1 = new MessageTraceDataSet.< > c__DisplayClass3 <T>(); CS$ < > 8__locals1.columnSchema = table.Columns; foreach (object obj in table.Rows) { DataRow dataRow = (DataRow)obj; MessageTraceEntityBase entity = Activator.CreateInstance <T>(); IEnumerable <PropertyDefinition> propertyDefinitions = (IEnumerable <PropertyDefinition>)entity.GetAllProperties(); using (IEnumerator enumerator2 = CS$ < > 8__locals1.columnSchema.GetEnumerator()) { while (enumerator2.MoveNext()) { DataColumn column = (DataColumn)enumerator2.Current; try { PropertyDefinition propertyDefinition2 = propertyDefinitions.First((PropertyDefinition propertyDefinition) => string.Compare(propertyDefinition.Name, column.ColumnName, StringComparison.OrdinalIgnoreCase) == 0); if (propertyDefinition2 != null) { entity[propertyDefinition2] = DalHelper.ConvertFromStoreObject(dataRow[column], propertyDefinition2.Type); } } catch (InvalidOperationException) { } } } PropertyBase propertyBase = entity as PropertyBase; if (propertyBase != null && propertyBase.PropertyName == MessageTraceCollapsedProperty.PropertyDefinition.Name) { byte[] data = Convert.FromBase64String(propertyBase.PropertyValueBlob.Value); list.AddRange(MessageTraceCollapsedProperty.Expand <PropertyBase>(data, propertyBase.Namespace, delegate { PropertyBase propertyBase2 = Activator.CreateInstance <T>() as PropertyBase; using (IEnumerator enumerator3 = CS$ < > 8__locals1.columnSchema.GetEnumerator()) { while (enumerator3.MoveNext()) { MessageTraceDataSet.< > c__DisplayClass3 <T> CS$ < > 8__locals4 = CS$ < > 8__locals1; DataColumn column = (DataColumn)enumerator3.Current; try { PropertyDefinition propertyDefinition3 = propertyDefinitions.First((PropertyDefinition propertyDefinition) => string.Compare(propertyDefinition.Name, column.ColumnName, StringComparison.OrdinalIgnoreCase) == 0); if (propertyDefinition3 != null && propertyDefinition3 != PropertyBase.PropertyValueBlobProperty) { propertyBase2[propertyDefinition3] = entity[propertyDefinition3]; } } catch (InvalidOperationException) { } } } propertyBase2.PropertyId = Guid.NewGuid(); return(propertyBase2); }));
private static bool TryGetCollapsedProperties(IDictionary <string, T> nameToPropDict, string nameSpace, string name, out IEnumerable <PropertyBase> expandedProperties) { expandedProperties = null; T t; bool result; if (result = nameToPropDict.TryGetValue(MessageTraceCollapsedProperty.PropertyDefinition.Name, out t)) { byte[] data = Convert.FromBase64String(t.PropertyValueBlob.Value); expandedProperties = MessageTraceCollapsedProperty.Expand <MessageEventProperty>(data, name, () => new MessageEventProperty(nameSpace, name, false)); } return(result); }