public object GetProperty(IRefBase obj, string name) { if (!_properties.TryGetValue(name, out var pi)) { throw new MemberNotFoundException(TypeName, name); } return(pi.GetValue(obj)); }
public void SetProperty <T>(IRefBase obj, string name, T value) { if (!_properties.TryGetValue(name, out var pi)) { throw new MemberNotFoundException(TypeName, name); } pi.SetValue(obj, value); }
private void Reflect(IClassBase classBase, IRefBase refBase) { if (!(refBase.BaseValue is IReflected reflected)) { return; } reflected.SelfBase = refBase; if (!(refBase is ConstRefBase self)) { throw new Exception("Internal error: IRef is not a ConstRef"); } self.Registry = this; self.Class = classBase; }
public IRef <T> GetProperty <T>(IRefBase obj, string name) { // TODO: only store IRef<T> properties and fields. return(null); }
public void SetValue(IRefBase objectBase, object value) { throw new System.NotImplementedException(); }
private void AddNewInstance(IClassBase classBase, IRefBase refBase, Id id) { Reflect(classBase, refBase); _instances.Add(id, refBase); }
public override void NewRef(Id id, out IRefBase refBase) => refBase = new Ref <T>(_registry, this, id);
public virtual void NewRef(Id id, out IRefBase refBase) { refBase = new RefBase(_registry, this, id); }