bool IRuntimeMetadata.TryGetBinder(string name, out IMemberBinder binder) { if (Type.TryFindMember(name, TypeUtils.AnyPublic, out binder)) { return(true); } if (m_value is IRuntimeMetadata) { return(((IRuntimeMetadata)m_value).TryGetBinder(name, out binder)); } return(false); }
bool IRuntimeMetadata.TryGetBinder(string name, out IMemberBinder binder) { var i = FindEntry(name); if (i >= 0) { binder = new DynamicBinder(entries[i].Key); return(true); } binder = null; return(false); }
public void Prepare(IDataReader reader) { for (int i = 0; i < this._argumentActivators.Count; i++) { IObjectActivator argumentActivator = this._argumentActivators[i]; argumentActivator.Prepare(reader); } for (int i = 0; i < this._memberBinders.Count; i++) { IMemberBinder binder = this._memberBinders[i]; binder.Prepare(reader); } }
public virtual object CreateInstance(IDataReader reader) { if (this._checkNullOrdinal != null) { if (reader.IsDBNull(this._checkNullOrdinal.Value)) { return(null); } } object obj = this._instanceCreator(reader, this._argumentActivators); IMemberBinder memberBinder = null; try { int count = this._memberBinders.Count; for (int i = 0; i < count; i++) { memberBinder = this._memberBinders[i]; memberBinder.Bind(obj, reader); } } catch (ChloeException) { throw; } catch (Exception ex) { PrimitiveMemberBinder binder = memberBinder as PrimitiveMemberBinder; if (binder != null) { throw new ChloeException(AppendErrorMsg(reader, binder.Ordinal, ex), ex); } throw; } return(obj); }
public RuntimeMemberBinder(IMemberBinder member) { this.member = member; }
bool IRuntimeMetadata.GetOrCreateBinder(string name, object value, Type type, out IMemberBinder binder) { if (Type.TryFindMember(name, TypeUtils.AnyPublic, out binder)) { return(true); } if (m_value is IRuntimeMetadata) { return(((IRuntimeMetadata)m_value).GetOrCreateBinder(name, value, type, out binder)); } return(false); }
bool IRuntimeMetadata.GetOrCreateBinder(string name, object value, System.Type type, out IMemberBinder binder) { var i = FindEntry(name); if (i >= 0) { binder = new DynamicBinder(entries[i].Key); return(true); } binder = new DynamicBinder(Insert(name, value, type)); return(true); }
public static bool FindMember(this Type type, string name, BindingFlags flags, out IMemberBinder binder) { if (type != null) { var properties = type.GetProperties(flags); for (int i = 0; i < properties.Length; i++) { var p = properties[i]; var data = (Attribute[])p.GetCustomAttributes(typeof(RegisterAttribute), false); if (data.Length > 0 && data[0].Match(name)) { binder = new PropertyBinder(p); return(true); } } var fields = type.GetFields(flags); for (int i = 0; i < fields.Length; i++) { var f = fields[i]; var data = (System.Attribute[])f.GetCustomAttributes(typeof(RegisterAttribute), false); if (data.Length > 0 && data[0].Match(name)) { binder = new FieldBinder(f); return(true); } } return(FindMember(type.BaseType, name, flags, out binder)); } binder = null; return(false); }
public static bool TryFindMember(this Type type, string name, BindingFlags flags, out IMemberBinder binder) { if (type.IsDefined(typeof(RegisterAttribute), false)) { return(FindMember(type, name, flags, out binder)); } binder = FindSystemMember(type, name, flags); return(binder != null); }