Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0

using System;

namespace Moryx.AbstractionLayer.Resources.Attributes;

/// <summary>
/// Specifies the synchronization behavior for a resource's digital twin
/// across multiple application instances.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class ResourceSynchronizationAttribute: Attribute
{
/// <summary>
/// Defines the property serialization strategy for this resource.
/// </summary>
public SynchronizationMode Mode { get; set; }
}

/// <summary>
/// Defines the property serialization strategy.
/// </summary>
public enum SynchronizationMode
{
/// <summary>
/// The entire resource object, including all its properties, is serialized and synchronized.
/// </summary>
Full,

/// <summary>
/// Only properties explicitly marked with the [SynchronizableMember] attribute will be
/// serialized and synchronized.
/// </summary>
Selective
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0

using System;

namespace Moryx.AbstractionLayer.Resources.Attributes;

/// <summary>
/// Marks a property as included in the payload when its class
/// is using 'Selective' synchronization mode.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class SynchronizableMemberAttribute : Attribute { }
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) 2025, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0

using System;

namespace Moryx.AbstractionLayer.Resources;

Expand Down