-
Notifications
You must be signed in to change notification settings - Fork 24
/
ProductInstance.cs
50 lines (44 loc) · 1.4 KB
/
ProductInstance.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0
using System.Runtime.Serialization;
namespace Moryx.AbstractionLayer.Products
{
/// <summary>
/// Base class for all product instances.
/// </summary>
[DataContract]
public abstract class ProductInstance : IProductInstance, IPersistentObject
{
/// <summary>
/// The Id of this instance
/// </summary>
public long Id { get; set; }
/// <summary>
/// The product type of this instance
/// </summary>
public IProductType Type { get; set; }
/// <summary>
/// The current state of the instance
/// </summary>
public ProductInstanceState State { get; set; }
/// <summary>
/// Part link that created this <see cref="ProductInstance"/>. This is <value>null</value> for root instances
/// </summary>
public IProductPartLink PartLink { get; set; }
}
/// <summary>
/// Generic base class for product type access
/// </summary>
public abstract class ProductInstance<TProduct> : ProductInstance
where TProduct : IProductType
{
/// <summary>
/// Typed property for product access
/// </summary>
public new TProduct Type
{
get => (TProduct) base.Type;
set => base.Type = value;
}
}
}