internal static Type GetDynamicObjectBuilderType(ThrowingHashSet<IPropertyInfo> properties) { lock (SyncRoot) { TypeSignature signature = new TypeSignature(properties); Type type; if (!TypesCache.TryGetValue(signature, out type)) { type = CreateDynamicObjectBuilderType(properties); TypesCache.Add(signature, type); } return type; } }
internal static Record CreateRecord(IEnumerable<SchemaInfo> schemas) { EnsureSchemaInfo(schemas); ThrowingHashSet<IPropertyInfo> propertyInfos = new ThrowingHashSet<IPropertyInfo>(); foreach (SchemaInfo schema in schemas) { propertyInfos.Add(ConverterFactory.CreatePropertyInfo(schema)); } Record ret = (Record)Activator.CreateInstance(RecordBuilder.GetDynamicObjectBuilderType(propertyInfos)); foreach (IPropertyInfo propInfo in propertyInfos) { ICell cell = propInfo.CreateCell(ret); ret.valuesStorage.Add(propInfo.PropertyName, cell); } return ret; }