public void AddDefault <TD>(SchemaAppKey key) { SchemaFieldDef <TD, SchemaAppKey> f = appFields.GetField <TD>(key); AppDict.Add(key, new SchemaAppDataField <TD>(f.Value, f)); }
private SchemaDefinitionApp() { subSchemaFieldInfo = new SchemaFieldDef <SchemaAppKey, string>(UNDEFINED, "RootCellsDefinition{0:D2}", "subschema for a cells definition"); DefineFields(); }
public void AddDefault <TD>(SchemaRootKey key) { SchemaFieldDef <TD, SchemaRootKey> f = rootFields.GetField <TD>(key); rootDict.Add(key, new SchemaRootDataField <TD>(f.Value, f)); }
public override object GetValue(int i) { if (m_dataEnumerator == null) { throw new ObjectDisposedException(GetType().Name); } var value = m_selector(m_dataEnumerator.Current, m_schema[i].FieldName); if (value == null) { return(DBNull.Value); } var strValue = value as string; if (strValue != null) { if (strValue.Length > m_schema[i].Size && m_schema[i].Size > 0) { strValue = strValue.Substring(0, m_schema[i].Size); } if (m_schema[i].DataType == DbType.String) { return(strValue); } return(SchemaFieldDef.StringToTypedValue(strValue, m_schema[i].DataType) ?? DBNull.Value); } return(value); }
public SchemaFieldDef <SchemaAppKey, string> GetSubSchemaDef(int id) { SchemaFieldDef <SchemaAppKey, string> subDef = new SchemaFieldDef <SchemaAppKey, string>(); subDef.Sequence = SubSchemaFieldInfo.Sequence; subDef.Name = string.Format(SubSchemaFieldInfo.Name, id); subDef.Desc = SubSchemaFieldInfo.Desc; subDef.Guid = SchemaGuidManager.GetCellGuidString(id); return(subDef); }
private void makeSchemaField <T>(ref SchemaBuilder sbld, SchemaFieldDef <T> fieldDef) where T : Enum { Type t = fieldDef.Value.GetType(); FieldBuilder fbld = sbld.AddSimpleField( fieldDef.Name, fieldDef.Value.GetType()); fbld.SetDocumentation(fieldDef.Desc); if (fieldDef.UnitType != RevitUnitType.UT_UNDEFINED) { fbld.SetUnitType((UnitType)(int)fieldDef.UnitType); } }
public async Task <List <SchemaFieldDef> > GetFieldsAsync(params string[] ignoreFields) { return(await Task.Run(() => { var schema = Connection.GetSchema("Columns", new[] { null, null, TableName }); return (from row in schema.AsEnumerable() let fieldName = row.Field <string>("COLUMN_NAME") let size = row.Field <int?>("CHARACTER_MAXIMUM_LENGTH") let dataType = SchemaFieldDef.StringToDataType(row.Field <string>("DATA_TYPE")) where !ignoreFields.Contains(fieldName) select new SchemaFieldDef { FieldName = fieldName, Size = size ?? 0, DataType = dataType }).ToList(); })); }
private void makeSchemaSubSchemaFields(ref SchemaBuilder sb, ExStoreCell xCell) { xCell.SubSchemaFields = new Dictionary <string, string>(); int count = xCell.Data.Count; count = count == 0 ? 3 : count; for (int i = 0; i < xCell.Data.Count; i++) { SchemaFieldDef <SchemaAppKey> subS = SchemaDefinitionApp.GetSubSchemaDef(i); string guid = subS.Guid; string name = subS.Name; FieldBuilder fb = sb.AddSimpleField(name, typeof(Entity)); fb.SetDocumentation(subS.Desc); fb.SetSubSchemaGUID(new Guid(guid)); xCell.SubSchemaFields.Add(name, guid); } }