protected override void Init(Lifetime lifetime) { base.Init(lifetime); var serializationContext = SerializationContext; if (!OptimizeNested) { Change.Advise(lifetime, v => { if (IsLocalChange) { v.IdentifyPolymorphic(Proto.Identities, Proto.Identities.Next(RdId)); } }); } Advise(lifetime, v => { if (!IsLocalChange) { return; } if (IsMaster) { myMasterVersion++; } Wire.Send(RdId, SendContext.Of(serializationContext, v, this), (sendContext, writer) => { var sContext = sendContext.SzrCtx; var evt = sendContext.Event; var me = sendContext.This; writer.Write(me.myMasterVersion); me.WriteValueDelegate(sContext, writer, evt); if (LogSend.IsTraceEnabled()) { LogSend.Trace("property `{0}` ({1}):: ver = {2}, value = {3}", me.Location, me.RdId, me.myMasterVersion, me.Value.PrintToString()); } }); }); Wire.Advise(lifetime, this); if (!OptimizeNested) { this.View(lifetime, (lf, v) => { v.BindPolymorphic(lf, this, "$"); }); } }
public void Advise(Lifetime lifetime, Action <R> handler) => Change.Advise(lifetime, handler);