/// <summary> /// Invoked when a get memebr operation is resolved dynamically. /// </summary> /// <param name="binder">Provides information about the operation to execute.</param> /// <param name="result">Holder for the result of the operation.</param> /// <returns>True if the operation executed successfully, false otherwise.</returns> public override bool TryGetMember(GetMemberBinder binder, out object result) { if (IsDisposed) { throw new ObjectDisposedException(this.ToString()); } var list = _Schema.FindTable(binder.Name).ToList(); if (list.Count != 0) { result = new RecordBuilderResolver(this, binder.Name); list.Clear(); list = null; return(true); } list = _Schema.FindColumn(binder.Name).ToList(); if (list.Count == 1) { result = this[binder.Name]; list.Clear(); list = null; return(true); } if (list.Count == 0) { result = new RecordBuilderResolver(this, binder.Name); return(true); } throw new DuplicateException( "Column '{0}' found in several columns in '{1}'.".FormatWith(binder.Name, this)); }
/// <summary> /// Invoked when a get memebr operation is resolved dynamically. /// </summary> /// <param name="binder">Provides information about the operation to execute.</param> /// <param name="result">Holder for the result of the operation.</param> /// <returns>True if the operation executed successfully, false otherwise.</returns> public override bool TryGetMember(GetMemberBinder binder, out object result) { if (IsDisposed) throw new ObjectDisposedException(this.ToString()); var list = _Schema.FindTable(binder.Name).ToList(); if (list.Count != 0) { result = new RecordBuilderResolver(this, binder.Name); list.Clear(); list = null; return true; } list = _Schema.FindColumn(binder.Name).ToList(); if (list.Count == 1) { result = this[binder.Name]; list.Clear(); list = null; return true; } if (list.Count == 0) { result = new RecordBuilderResolver(this, binder.Name); return true; } throw new DuplicateException( "Column '{0}' found in several columns in '{1}'.".FormatWith(binder.Name, this)); }