Exemple #1
0
        public ByteArrayFieldModel(Modeler modeler, SchemaEntityTypeProperty property, string propertyTypeKeyword,
                                   IList <SqlTypeParameter> propertyTypeArguments) : base(modeler, property, propertyTypeKeyword, propertyTypeArguments)
        {
            switch (propertyTypeKeyword)
            {
            case "timestamp":
            case "rowversion":
                IsFixedLength = true;
                MaxLength     = property.MaxLengthSpecified ? property.MaxLength : 8;
                IsRowVersion  = true;
                return;

            case "binary":
                IsFixedLength = true;
                MaxLength     = property.MaxLengthSpecified ? property.MaxLength : 1;
                return;

            case "varbinary":
                IsFixedLength = false;
                MaxLength     = property.MaxLengthSpecified
                        ? property.MaxLength
                        : int.MaxValue;
                if (propertyTypeArguments.All(pt => pt.ConstantValue != SqlTypeParameter.Constant.Max))
                {
                    return;
                }
                MaxLength = int.MaxValue;
                return;

            case "image":
                IsFixedLength = false;
                MaxLength     = int.MaxValue;
                return;
            }

            /*
             * this.Property(t => t.RowVersion)
             *  .IsFixedLength()
             *  .HasMaxLength(8)
             *  .IsRowVersion();
             */
        }
Exemple #2
0
        public StringFieldModel(Modeler modeler, SchemaEntityTypeProperty property, string propertyTypeKeyword,
                                IList <SqlTypeParameter> propertyTypeArguments) : base(modeler, property, propertyTypeKeyword, propertyTypeArguments)
        {
            switch (propertyTypeKeyword)
            {
            case "char":
            case "nchar":
            case "text":
            case "ntext":
                IsFixedLength = true;
                MaxLength     = property.MaxLengthSpecified ? property.MaxLength : 0;
                return;

            case "varchar":
            case "nvarchar":
                IsFixedLength = false;
                MaxLength     = property.MaxLengthSpecified ? property.MaxLength : 0;
                return;
            }
        }
Exemple #3
0
 public ByteFieldModel(Modeler modeler, SchemaEntityTypeProperty property, string propertyTypeKeyword, IList <SqlTypeParameter> propertyTypeArguments) : base(modeler, property, propertyTypeKeyword, propertyTypeArguments)
 {
 }
Exemple #4
0
 protected FieldModel(Modeler modeler, SchemaEntityTypeProperty property, string propertyTypeKeyword, IList <SqlTypeParameter> propertyTypeArguments)
     : base(modeler, property, propertyTypeKeyword, propertyTypeArguments)
 {
     FieldType = typeof(T);
 }