// Configures and displays the editor dialog based on the specified property name private bool Initialize(EntityDataSourceDesigner designer, EntityDataSource entityDataSource, string propertyName, IServiceProvider serviceProvider, string statement) { string propertyParameters = GetOperationParameterProperty(propertyName); string autoGenProperty = GetOperationAutoGenerateProperty(propertyName); bool hasAutoGen = (autoGenProperty != null); bool autoGen = GetAutoGen(propertyName, designer); ParameterCollection parameters = GetParameters(propertyName, designer); string label = GetStatementLabel(propertyName, false); string accessibleName = GetStatementLabel(propertyName, true); string helpTopic = GetHelpTopic(propertyName); EntityDataSourceStatementEditorForm form = new EntityDataSourceStatementEditorForm(entityDataSource, serviceProvider, hasAutoGen, autoGen, propertyName, label, accessibleName, helpTopic, statement, parameters); DialogResult result = UIHelper.ShowDialog(serviceProvider, form); if (result == DialogResult.OK) { // We use the property descriptors to reset the values to // make sure we clear out any databindings or expressions that // may be set. PropertyDescriptor propDesc = null; if (autoGenProperty != null) { propDesc = TypeDescriptor.GetProperties(entityDataSource)[autoGenProperty]; propDesc.ResetValue(entityDataSource); propDesc.SetValue(entityDataSource, form.AutoGen); } if (propertyName != null) { propDesc = TypeDescriptor.GetProperties(entityDataSource)[propertyName]; propDesc.ResetValue(entityDataSource); propDesc.SetValue(entityDataSource, form.Statement); } if (propertyParameters != null) { SetParameters(propertyName, designer, form.Parameters); } return(true); } else { return(false); } }
// Configures and displays the editor dialog based on the specified property name private bool Initialize(EntityDataSourceDesigner designer, EntityDataSource entityDataSource, string propertyName, IServiceProvider serviceProvider, string statement) { string propertyParameters = GetOperationParameterProperty(propertyName); string autoGenProperty = GetOperationAutoGenerateProperty(propertyName); bool hasAutoGen = (autoGenProperty != null); bool autoGen = GetAutoGen(propertyName, designer); ParameterCollection parameters = GetParameters(propertyName, designer); string label = GetStatementLabel(propertyName, false); string accessibleName = GetStatementLabel(propertyName, true); string helpTopic = GetHelpTopic(propertyName); EntityDataSourceStatementEditorForm form = new EntityDataSourceStatementEditorForm(entityDataSource, serviceProvider, hasAutoGen, autoGen, propertyName, label, accessibleName, helpTopic, statement, parameters); DialogResult result = UIHelper.ShowDialog(serviceProvider, form); if (result == DialogResult.OK) { // We use the property descriptors to reset the values to // make sure we clear out any databindings or expressions that // may be set. PropertyDescriptor propDesc = null; if (autoGenProperty != null) { propDesc = TypeDescriptor.GetProperties(entityDataSource)[autoGenProperty]; propDesc.ResetValue(entityDataSource); propDesc.SetValue(entityDataSource, form.AutoGen); } if (propertyName != null) { propDesc = TypeDescriptor.GetProperties(entityDataSource)[propertyName]; propDesc.ResetValue(entityDataSource); propDesc.SetValue(entityDataSource, form.Statement); } if (propertyParameters != null) { SetParameters(propertyName, designer, form.Parameters); } return true; } else { return false; } }