private MetaSqliteRow CacheMetaRowExplicitTag(Type type) { MetaSqliteRow newCacheRow = new MetaSqliteRow(); //Get table name SqliteTableAttribute tableAttribute = ((SqliteTableAttribute[])type.GetCustomAttributes(typeof(SqliteTableAttribute), inherit: false)).FirstOrDefault(); if (tableAttribute == null) { throw new NotSupportedException("Expected Class attribute \"SqliteTable\""); } newCacheRow.TableName = tableAttribute.TableName; var propertyInfoList = type.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); //Process properties foreach (PropertyInfo propertyInfo in propertyInfoList) { SqliteCellAttribute cellAttribute = ((SqliteCellAttribute[])propertyInfo.GetCustomAttributes(typeof(SqliteCellAttribute), inherit: false)).FirstOrDefault(); if (cellAttribute == null) { //Skip attributes that aren't tagged with EZ-Mode data types continue; } newCacheRow.MetaSqliteCells.Add(new MetaSqliteCell(cellAttribute, propertyInfo, publicOnly: false)); } //Add the row to the schema map for easier traversal in the future rowSchemaMap.Add(type, newCacheRow); return(newCacheRow); }
public MetaSqliteCell(SqliteCellAttribute cellAttribute, PropertyInfo propertyInfo, bool publicOnly) { this.OriginalType = propertyInfo.PropertyType; this.ColumnName = cellAttribute.ColumnName != null ? cellAttribute.ColumnName : propertyInfo.Name; this.IsPrimaryId = cellAttribute.IsPrimaryId; this.CellAttribute = cellAttribute; this.GetValueMethod = propertyInfo.GetGetMethod(nonPublic: !publicOnly); this.SetValueMethod = propertyInfo.GetSetMethod(nonPublic: !publicOnly); }