private void makeSchemaFields <T>(ref SchemaBuilder sbld, SchemaDictionaryBase <T> fieldList) where T : Enum { foreach (KeyValuePair <T, ISchemaFieldDef <T> > kvp in fieldList) { makeSchemaField(ref sbld, kvp.Value); } }
private void MakeFields <T>(SchemaBuilder sbld, SchemaDictionaryBase <T> fieldList) { foreach (KeyValuePair <T, SchemaFieldUnit> kvp in fieldList) { MakeField(sbld, kvp.Value); } }
public static void ListFieldInfo <T>(SchemaDictionaryBase <T> fieldList, int count = -1) { int i = 0; foreach (KeyValuePair <T, SchemaFieldUnit> kvp in fieldList) { if (i == count) { return; } logMsgDbLn2("field #" + i++, FormatFieldInfo(kvp.Key as Enum, kvp.Value)); } }
/// <summary> /// write the data into the entity based on the schema <br/> /// the schema has already been added to the entity /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> /// <param name="schema"></param> /// <param name="data"></param> private void writeData <T>(Entity entity, Schema schema, SchemaDictionaryBase <T> data) where T : Enum { foreach (KeyValuePair <T, SchemaFieldDef <T> > kvp in data) { Field f = schema.GetField(kvp.Value.Name); if (f == null || !f.IsValidObject) { continue; } if (kvp.Value.UnitType != RevitUnitType.UT_UNDEFINED) { entity.Set(f, kvp.Value.Value, DisplayUnitType.DUT_GENERAL); } else { entity.Set(f, kvp.Value.Value); } } }
// save the settings held in the private void SaveFieldValues <T>(Entity entity, Schema schema, SchemaDictionaryBase <T> fieldList) { foreach (KeyValuePair <T, SchemaFieldUnit> kvp in fieldList) { Field field = schema.GetField(kvp.Value.Name); if (field == null || !field.IsValidObject) { continue; } if (kvp.Value.UnitType != RevitUnitType.UT_UNDEFINED) { entity.Set(field, kvp.Value.Value, DisplayUnitType.DUT_GENERAL); } else { entity.Set(field, kvp.Value.Value); } } }