public static GdbTable FromObjectClassMsg( [NotNull] ObjectClassMsg objectClassMsg, [CanBeNull] IWorkspace workspace, [CanBeNull] Func <ITable, BackingDataset> createBackingDataset = null) { esriGeometryType geometryType = (esriGeometryType)objectClassMsg.GeometryType; GdbTable result; if (geometryType == esriGeometryType.esriGeometryNull) { result = new GdbTable(objectClassMsg.ClassHandle, objectClassMsg.Name, objectClassMsg.Alias, createBackingDataset, workspace); } else { result = new GdbFeatureClass( objectClassMsg.ClassHandle, objectClassMsg.Name, (esriGeometryType)objectClassMsg.GeometryType, objectClassMsg.Alias, createBackingDataset, workspace) { SpatialReference = ProtobufGeometryUtils.FromSpatialReferenceMsg( objectClassMsg.SpatialReference) }; } if (objectClassMsg.Fields == null || objectClassMsg.Fields.Count <= 0) { return(result); } foreach (FieldMsg fieldMsg in objectClassMsg.Fields) { IField field = FieldUtils.CreateField(fieldMsg.Name, (esriFieldType)fieldMsg.Type, fieldMsg.AliasName); if (field.Type == esriFieldType.esriFieldTypeString) { ((IFieldEdit)field).Length_2 = fieldMsg.Length; } else if (field.Type == esriFieldType.esriFieldTypeGeometry) { var sr = ProtobufGeometryUtils.FromSpatialReferenceMsg( objectClassMsg.SpatialReference); field = FieldUtils.CreateShapeField(geometryType, sr, 1000, true, false); } if (result.Fields.FindField(field.Name) < 0) { result.AddField(field); } else { _msg.DebugFormat("Field {0} is duplicate or has been added previously", field.Name); } } return(result); }