private void BoundControl_DataBound(object sender, System.EventArgs e) { if (HasParentControlCalledDataBinding) { return; } Type type = sender.GetType(); _datasource = type.GetProperty("DataSource"); if (_datasource == null) { throw new NotSupportedException("分页控件要求表现控件必需包含一个DataSource。"); } object data = _datasource.GetGetMethod().Invoke(sender, null); _builder = Adapters[data.GetType()]; if (_builder == null) { throw new NullReferenceException("没有安装适当的适配器来处理下面的数据源类型:" + data.GetType()); } _builder.Source = data; ApplyDataSensitivityRules(); BindParent(); RaiseEvent(DataUpdate, this); }
private void BoundControl_DataBound(object sender, System.EventArgs e) { if (HasParentControlCalledDataBinding) return; Type type = sender.GetType(); _datasource = type.GetProperty("DataSource"); if (_datasource == null) throw new NotSupportedException("分页控件要求表现控件必需包含一个DataSource。"); object data = _datasource.GetGetMethod().Invoke(sender, null); _builder = Adapters[data.GetType()]; if (_builder == null) throw new NullReferenceException("没有安装适当的适配器来处理下面的数据源类型:" + data.GetType()); _builder.Source = data; ApplyDataSensitivityRules(); BindParent(); RaiseEvent(DataUpdate, this); }
public void Add(Type key, AdapterBuilder value) { Dictionary.Add(GetKey(key), value); }