private void SetTableTemplateColumnProperty(string domainID, string columnName, TableColumnProperties propertyName, object value) { if (columnName == null) { throw new ArgumentNullException(nameof(columnName)); } var template = this.GetDomainHost <ITableTemplate>(domainID); var authentication = this.Context.GetAuthentication(this); template.Dispatcher.Invoke(() => { var column = template[columnName]; if (column == null) { throw new ItemNotFoundException(columnName); } if (propertyName == TableColumnProperties.Index) { column.SetIndex(authentication, Convert.ToInt32(value)); } else if (propertyName == TableColumnProperties.IsKey) { column.SetIsKey(authentication, (bool)value); } else if (propertyName == TableColumnProperties.IsUnique) { column.SetIsUnique(authentication, (bool)value); } else if (propertyName == TableColumnProperties.Name) { column.SetName(authentication, (string)value); } else if (propertyName == TableColumnProperties.DataType) { column.SetDataType(authentication, (string)value); } else if (propertyName == TableColumnProperties.DefaultValue) { column.SetDefaultValue(authentication, $"{value}"); } else if (propertyName == TableColumnProperties.Comment) { column.SetComment(authentication, (string)value); } else if (propertyName == TableColumnProperties.AutoIncrement) { column.SetAutoIncrement(authentication, (bool)value); } else if (propertyName == TableColumnProperties.Tags) { column.SetTags(authentication, (TagInfo)(string)value); } else if (propertyName == TableColumnProperties.IsReadOnly) { column.SetIsReadOnly(authentication, (bool)value); } else if (propertyName == TableColumnProperties.AllowNull) { column.SetAllowNull(authentication, (bool)value); } else { throw new NotImplementedException(); } }); }
private object GetTableTemplateColumnProperty(string domainID, string columnName, TableColumnProperties propertyName) { if (columnName == null) { throw new ArgumentNullException(nameof(columnName)); } var template = this.GetDomainHost <ITableTemplate>(domainID); var authentication = this.Context.GetAuthentication(this); return(template.Dispatcher.Invoke(() => { var column = template[columnName]; if (column == null) { throw new ItemNotFoundException(columnName); } if (propertyName == TableColumnProperties.Index) { return (object)column.Index; } else if (propertyName == TableColumnProperties.IsKey) { return (object)column.IsKey; } else if (propertyName == TableColumnProperties.IsUnique) { return (object)column.IsUnique; } else if (propertyName == TableColumnProperties.Name) { return (object)column.Name; } else if (propertyName == TableColumnProperties.DataType) { return (object)column.DataType; } else if (propertyName == TableColumnProperties.DefaultValue) { return (object)column.DefaultValue; } else if (propertyName == TableColumnProperties.Comment) { return (object)column.Comment; } else if (propertyName == TableColumnProperties.AutoIncrement) { return (object)column.AutoIncrement; } else if (propertyName == TableColumnProperties.Tags) { return (object)(string)column.Tags; } else if (propertyName == TableColumnProperties.IsReadOnly) { return (object)column.IsReadOnly; } else if (propertyName == TableColumnProperties.AllowNull) { return (object)column.AllowNull; } else { throw new NotImplementedException(); } })); }