Ejemplo n.º 1
0
 public CremaTemplateColumn(CremaTemplateColumnBuilder builder)
 {
     if (builder == null)
     {
         throw new ArgumentNullException();
     }
     this.template = builder.Template;
     this.row      = builder.DataRow;
 }
Ejemplo n.º 2
0
        public CremaTemplate(CremaDataTable targetTable)
        {
            if (targetTable == null)
            {
                throw new ArgumentNullException(nameof(targetTable));
            }
            if (targetTable.TemplateNamespace != string.Empty)
            {
                throw new ArgumentException(Resources.Exception_CannotEditInheritedTable, nameof(targetTable));
            }

            this.builder  = new CremaTemplateColumnBuilder(this);
            this.template = new InternalTemplate(this, this.builder)
            {
                TargetTable = (InternalDataTable)targetTable
            };
            this.attributes = new CremaAttributeCollection(this.template);
            this.columns    = new CremaTemplateColumnCollection(this.template);

            this.AttachEventHandlers();
        }
Ejemplo n.º 3
0
        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";
        }
Ejemplo n.º 4
0
 internal CremaTemplateColumn InvokeNewTemplateColumnFromBuilder(CremaTemplateColumnBuilder builder)
 {
     return(new CremaTemplateColumn(builder));
 }
Ejemplo n.º 5
0
 private CremaTemplateColumn NewTemplateColumnFromBuilder(CremaTemplateColumnBuilder builder)
 {
     return(new CremaTemplateColumn(builder));
 }
Ejemplo n.º 6
0
 public InternalTemplateColumn(CremaTemplateColumnBuilder builder, InternalTemplate table)
     : base(table, builder.InternalBuilder)
 {
     this.table  = table;
     base.Target = builder.NewColumn(this);
 }