Exemplo n.º 1
0
        public object GetProperty(IRefBase obj, string name)
        {
            if (!_properties.TryGetValue(name, out var pi))
            {
                throw new MemberNotFoundException(TypeName, name);
            }

            return(pi.GetValue(obj));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 public IRef <T> GetProperty <T>(IRefBase obj, string name)
 {
     // TODO: only store IRef<T> properties and fields.
     return(null);
 }
Exemplo n.º 5
0
 public void SetValue(IRefBase objectBase, object value)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 6
0
 private void AddNewInstance(IClassBase classBase, IRefBase refBase, Id id)
 {
     Reflect(classBase, refBase);
     _instances.Add(id, refBase);
 }
Exemplo n.º 7
0
 public override void NewRef(Id id, out IRefBase refBase)
 => refBase = new Ref <T>(_registry, this, id);
Exemplo n.º 8
0
 public virtual void NewRef(Id id, out IRefBase refBase)
 {
     refBase = new RefBase(_registry, this, id);
 }