Beispiel #1
0
        public AbstractAttributeDefinition GetDefinition(Entity type, ushort key)
        {
            AbstractAttributeDefinition result = null;

            switch (type)
            {
            case Entity.Part:
                PartAttributesDict.TryGetValue(key, out result);
                break;

            case Entity.Characteristic:
                CharacteristicAttributesDict.TryGetValue(key, out result);
                break;

            case Entity.Measurement:
                MeasurementAttributesDict.TryGetValue(key, out result);
                break;

            case Entity.Value:
                ValueAttributesDict.TryGetValue(key, out result);
                break;

            case Entity.Catalog:
                CatalogAttributesDict.TryGetValue(key, out result);
                break;
            }
            return(result);
        }
Beispiel #2
0
 /// <summary>
 /// Adds a new attribute definition to the database configuration for the specified <paramref name="entity"/>.
 /// </summary>
 /// <param name="client">The client class to use.</param>
 /// <param name="entity">The entity the attribute definition should be added to.</param>
 /// <param name="definition">The attribute definition to add.</param>
 /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
 public static Task CreateAttributeDefinition <T>(this IDataServiceRestClientBase <T> client, Entity entity, AbstractAttributeDefinition definition, CancellationToken cancellationToken = default(CancellationToken)) where T : DataServiceFeatureMatrix
 {
     return(client.CreateAttributeDefinitions(entity, new[] { definition }, cancellationToken));
 }