Show / Hide Table of Contents

Class BsonCachedPropertyAttribute

Should be used with property having ServerRAMCached, specifies which property used as a cached counterpart of the attributed property. May be set manually or will be automatically added by Eco.Fody.SyncToViewCacheWeaving for every property with the flag. Then the getter of the cached property will be used by Eco.Core.Controller.SyncPropertyInfo instead of the property getter. When added manually then user code is responsible for cached value invalidation. May be preferred over auto-weaving when cached value is immutable or class doesn't match auto-weaving conditions.

public class Foo
{
    BSONCachedValue CachedItems { get; set; }
    [SyncToView(SyncFlags.Cached), BsonCachedProperty("CachedItems")] public List<Item> Items { get; }
    public Foo(IEnumerable<Item> items)
    {
       this.Items = items.ToList();
       this.CachedItems = BSONCachedValue.Cache(this.Items.ToBson());
    }
}
Read more details about auto-caching in Eco.Fody/README.md.

Inheritance
System.Object
BsonCachedPropertyAttribute
Namespace: Eco.Core.Controller
Assembly: Eco.Core.dll
Syntax
public class BsonCachedPropertyAttribute : Attribute

Constructors

BsonCachedPropertyAttribute(String)

Declaration
public BsonCachedPropertyAttribute(string cachedPropertyName)
Parameters
Type Name Description
System.String cachedPropertyName

Properties

CachedPropertyName

Name of cached property which will be used instead of the property during view synchronization.

Declaration
public string CachedPropertyName { get; }
Property Value
Type Description
System.String

Extension Methods

PropertyChanges.FirePropertyChanged(Object, String)
PropertyChanges.FirePropertyChanged(Object, String, Object, Object)
PropertyChanges.FirePropertyChanged(Object, MemberChangedBeforeAfterEventArgs)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾