public InternalDataTable(CremaDataTable target, string name, string categoryPath) : base(name, categoryPath) { this.childList2 = new ReadOnlyObservableCollection <InternalDataTable>(this.childList); if (base.ChildItems is INotifyCollectionChanged childTables) { childTables.CollectionChanged += ChildTables_CollectionChanged; } this.attributeTag = new InternalAttribute(CremaSchema.Tags, typeof(string)) { AllowDBNull = false, DefaultValue = TagInfo.All.ToString(), }; this.Columns.Add(this.attributeTag); this.attributeEnable = new InternalAttribute(CremaSchema.Enable, typeof(bool)) { AllowDBNull = false, DefaultValue = true, }; this.Columns.Add(this.attributeEnable); base.Target = target ?? new CremaDataTable(this); this.Columns.CollectionChanged += Columns_CollectionChanged; this.Constraints.CollectionChanged += Constraints_CollectionChanged; this.creationInfo = this.modificationInfo = this.SignatureDateProvider.Provide(); }
private void ValidateConstructor(string attributeName, Type dataType) { if (string.IsNullOrEmpty(attributeName) == false) { InternalAttribute.ValidateAttributeName(attributeName); } if (dataType == null) { throw new ArgumentNullException(nameof(dataType)); } if (CremaDataTypeUtility.IsBaseType(dataType) == false) { throw new ArgumentException(string.Format(Resources.Exception_TypeCannotBeUsed_Format, dataType.Name), nameof(dataType)); } }
public void CopyTo(InternalAttribute dest) { dest.InternalAllowDBNull = this.InternalAllowDBNull; dest.InternalAutoIncrement = this.InternalAutoIncrement; dest.InternalColumnName = this.InternalColumnName; dest.InternalDataType = this.InternalDataType; dest.InternalDefaultValue = this.InternalDefaultValue; dest.InternalExpression = this.InternalExpression; //dest.InternalValidation = this.InternalValidation; dest.InternalUnique = this.InternalUnique; dest.InternalReadOnly = this.InternalReadOnly; dest.InternalComment = this.InternalComment; //dest.InternalIsKey = this.InternalIsKey; //dest.InternalCreationInfo = this.InternalCreationInfo; //dest.InternalModificationInfo = this.InternalModificationInfo; //dest.InternalTags = this.InternalTags; //dest.InternalColumnID = this.InternalColumnID; }
public InternalTemplate(CremaTemplate template, CremaTemplateColumnBuilder builder) : base("TableTemplate", PathUtility.Separator) { base.Target = template; this.builder = builder; this.columnID = new InternalAttribute(CremaSchema.ID, typeof(Guid)) { ColumnMapping = MappingType.Hidden, AllowDBNull = false, DefaultValue = Guid.NewGuid() }; this.Columns.Add(this.columnID); this.columnTags = new InternalAttribute(CremaSchema.Tags, typeof(string)) { ColumnMapping = MappingType.Attribute, DefaultValue = $"{TagInfo.All}" }; this.Columns.Add(this.columnTags); this.columnIsKey = new DataColumn(CremaSchema.IsKey, typeof(bool)) { DefaultValue = false, AllowDBNull = false }; this.Columns.Add(this.columnIsKey); this.columnColumnName = new DataColumn(CremaSchema.ColumnName) { DefaultValue = "Column1", AllowDBNull = false }; this.Columns.Add(this.columnColumnName); this.columnDataType = new DataColumn(CremaSchema.DataType) { DefaultValue = typeof(string).GetTypeName(), AllowDBNull = false }; this.Columns.Add(this.columnDataType); this.columnComment = new DataColumn(CremaSchema.Comment); this.Columns.Add(this.columnComment); this.columnDefaultValue = new DataColumn(CremaSchema.DefaultValue); this.Columns.Add(this.columnDefaultValue); this.columnAllowNull = new DataColumn(CremaSchema.AllowNull, typeof(bool)) { DefaultValue = true, AllowDBNull = false }; this.Columns.Add(this.columnAllowNull); this.columnReadOnly = new DataColumn(CremaSchema.ReadOnly, typeof(bool)) { DefaultValue = false, AllowDBNull = false }; this.Columns.Add(this.columnReadOnly); this.columnIsUnique = new DataColumn(CremaSchema.IsUnique, typeof(bool)) { DefaultValue = false, AllowDBNull = false }; this.Columns.Add(this.columnIsUnique); this.columnAutoIncrement = new DataColumn(CremaSchema.AutoIncrement, typeof(bool)) { DefaultValue = false, AllowDBNull = false }; this.Columns.Add(this.columnAutoIncrement); this.PrimaryKey = new DataColumn[] { this.columnColumnName }; this.DefaultView.Sort = $"{CremaSchema.Index} ASC"; }
internal CremaAttribute(InternalAttribute attribute) { this.attribute = attribute; }
public CremaAttribute(string attributeName, Type dataType) { this.attribute = new InternalAttribute(this, attributeName, dataType); }