Class ScyllaIncludeAttribute
Marks a non-public field or property to be included in Scylla serialization, overriding the default behavior that limits serialization to public members.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)]
public sealed class ScyllaIncludeAttribute : Attribute
Remarks
By default, the Scylla serialization engine only serializes members that are
publicly accessible. Applying [ScyllaInclude] to a private,
protected, or internal field or property causes it to be treated as
though it were public - it will be discovered, read, and written by the engine
without any additional configuration.
This attribute is self-sufficient: no changes to SerializationSettings
are required. The IncludePrivateFields setting
is a separate, independent mechanism that applies globally to all non-public members
of all serialized types. [ScyllaInclude] provides per-member opt-in control
and does not depend on that setting being enabled.
If a member is marked with both [ScyllaInclude] and
ScyllaIgnoreAttribute, the ignore attribute takes precedence and
the member will be excluded from serialization.
Common use cases include:
- Serializing private backing fields directly to preserve encapsulation.
- Persisting internal state that is not exposed through the public API.
- Including protected fields from base classes selectively.
public class PlayerData
{
public string Name { get; set; }
// Included despite being private - no settings change required.
[ScyllaInclude]
private int _internalID;
[ScyllaInclude]
private DateTime _createdAt;
}