コード例 #1
0
        /// <summary>
        /// Create a databasetype object that represents an expression type. (or as close as we can).
        /// </summary>
        /// <param name="exprType">The expression type.</param>
        public static DatabaseType ToDatabaseType(ExprType exprType)
        {
            if (exprType == null)
            {
                throw new ArgumentNullException("exprType");
            }

            if (exprType.Type != DataType.Entity)
            {
                return(DataTypeHelper.ToDatabaseType(exprType.Type));
            }

            if (exprType.EntityType == null)
            {
                return(DatabaseType.InlineRelationshipType);
            }

            var e = Entity.Get <EntityType>(exprType.EntityType.Id);

            if (e.Is <EnumType>())
            {
                return(DatabaseType.ChoiceRelationshipType);
            }
            return(DatabaseType.InlineRelationshipType);
        }
コード例 #2
0
 public BuilderSettings()
 {
     RootContextType         = new ExprType(DataType.None);
     DefaultDecimalPrecision = 3;
     DefaultCurrencyPlaces   = 2;
     ScriptHost = ScriptHostType.Any;
 }
コード例 #3
0
        /// <summary>
        /// Get an ExprType that's appropriate for a given field.
        /// </summary>
        /// <param name="fieldEntity"></param>
        /// <returns></returns>
        public static ExprType FromFieldEntity(IEntity fieldEntity)
        {
            DataType     dataType     = FieldHelper.ConvertToDataType(fieldEntity);
            ExprType     exprType     = new ExprType(dataType);
            DecimalField decimalField = fieldEntity.As <DecimalField>();

            if (decimalField != null)
            {
                exprType.DecimalPlaces = decimalField.DecimalPlaces;
            }
            return(exprType);
        }