public static DataView AsDataView(this CremaTemplate template)
 {
     if (Environment.OSVersion.Platform == PlatformID.Unix)
     {
         var view = AsDataViewUnix(template.InternalObject);
         return(view);
     }
     else
     {
         var view = AsDataViewNormal(template.InternalObject);
         return(view);
     }
 }
Esempio n. 2
0
 internal CremaTemplateColumnBuilder(CremaTemplate template)
 {
     this.Template = template;
 }
Esempio 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";
        }