Inheritance: SchemaItem
Esempio n. 1
0
		public SearchOrder(PropertyType propertyToOrder, OrderDirection direction)
		{
			if (propertyToOrder == null)
				throw new ArgumentNullException("propertyToOrder");
			_propertyToOrder = new PropertyLiteral(propertyToOrder);
			_direction = direction;
		}
Esempio n. 2
0
		internal override void AddPropertyType(PropertyType propertyType)
		{
			if (!propertyType.IsContentListProperty)
                throw new SchemaEditorCommandException(String.Concat("Only ContentListProperty can be assegned to a ContentListType. ContentListType=", this.Name, ", PropertyType=", propertyType.Name));
			if (!this.PropertyTypes.Contains(propertyType))
				this.PropertyTypes.Add(propertyType);
		}
Esempio n. 3
0
        // Returns a valid mapping if "pt" appears in the given page context.
        public static string GetValidMapping(int queryedPage, PropertyType pt)
        {
            string physicalName;
            int pageSize;
            switch(pt.DataType)
            {
                case DataType.String:
                    physicalName = SqlProvider.StringMappingPrefix;
                    pageSize = SqlProvider.StringPageSize;
                    break;
                case DataType.Int:
                    physicalName = SqlProvider.IntMappingPrefix;
                    pageSize = SqlProvider.IntPageSize;
                    break;
                case DataType.DateTime:
                    physicalName = SqlProvider.DateTimeMappingPrefix;
                    pageSize = SqlProvider.DateTimePageSize;
                    break;
                case DataType.Currency:
                    physicalName = SqlProvider.CurrencyMappingPrefix;
                    pageSize = SqlProvider.CurrencyPageSize;
                    break;
                default:
                    return string.Empty;
            }

            int mappingIndex = pt.Mapping;
            int page = mappingIndex / pageSize;
            if(page != queryedPage)
                return string.Empty;

            int index = mappingIndex - (page * pageSize);
			return string.Concat(physicalName, index + 1);
		}
Esempio n. 4
0
		private void AddPropertyMapping(PropertyType pt)
		{
			switch (pt.DataType)
			{
				case DataType.String:
				case DataType.Int:
				case DataType.DateTime:
				case DataType.Currency:
					break;
				case DataType.Reference:
					if (!_referenceSlots.Contains(pt))
						_referenceSlots.Add(pt);
					break;
				case DataType.Binary:
					if (!_binarySlots.Contains(pt))
						_binarySlots.Add(pt);
					break;
				case DataType.Text:
					if (!_textSlots.Contains(pt))
						_textSlots.Add(pt);
					break;
				default:
					throw new NotSupportedException(pt.DataType.ToString());
			}
		}
Esempio n. 5
0
		//-- There are not any NodeAttribute with Currency datatype

		public CurrencyExpression(PropertyType property, ValueOperator op, decimal? value)
		{
			if (property == null)
				throw new ArgumentNullException("property");
			if (property.DataType != DataType.Currency)
				throw GetWrongPropertyDataTypeException("property", DataType.Currency);
			_binExp = new BinaryExpression(property, BinaryExpression.GetOperator(op), value);
		}
Esempio n. 6
0
		public DateTimeExpression(PropertyType property, ValueOperator op, DateTimeAttribute value)
		{
			if (property == null)
				throw new ArgumentNullException("property");
			if (property.DataType != DataType.DateTime)
				throw new ArgumentOutOfRangeException("property", "The DataType of 'property' must be DataType.DateTime");
			_binExp = new BinaryExpression(property, BinaryExpression.GetOperator(op), BinaryExpression.GetNodeAttribute(value));
		}
Esempio n. 7
0
		public StringExpression(StringAttribute property, StringOperator op, PropertyType value)
		{
			if (value == null)
				throw new ArgumentNullException("value");
			if (value.DataType != DataType.String)
				throw GetWrongPropertyDataTypeException("value", DataType.String);
			_binExp = new BinaryExpression((NodeAttribute)property, BinaryExpression.GetOperator(op), value);
		}
Esempio n. 8
0
		public StringExpression(PropertyType property, StringOperator op, StringAttribute value)
		{
			if (property == null)
				throw new ArgumentNullException("property");
			if (property.DataType != DataType.String)
				throw GetWrongPropertyDataTypeException("property", DataType.String);
			_binExp = new BinaryExpression(property, BinaryExpression.GetOperator(op), BinaryExpression.GetNodeAttribute(value));
		}
Esempio n. 9
0
		public ReferenceExpression(PropertyType referrerProperty)
		{
			if (referrerProperty == null)
				throw new ArgumentNullException("referrerProperty");
			if (referrerProperty.DataType != DataType.Reference)
				throw new ArgumentOutOfRangeException("referrerProperty", "The DataType of 'referrerProperty' must be Reference");
			_referrerProperty = new PropertyLiteral(referrerProperty);
			_existenceOnly = true;
		}
Esempio n. 10
0
        //================================================================================ Add Property

        public void WriteStringProperty(string value, PropertyType type)
        {
            WriteFlatProperty(
                type.Mapping,
                SqlProvider.StringPageSize,
                SqlProvider.StringMappingPrefix,
                SqlDbType.NVarChar,
                SqlProvider.StringDataTypeSize,
                value);
        }
Esempio n. 11
0
 public void WriteIntProperty(int value, PropertyType type)
 {
     WriteFlatProperty(
         type.Mapping,
         SqlProvider.IntPageSize,
         SqlProvider.IntMappingPrefix,
         SqlDbType.Int,
         0,
         value);
 }
Esempio n. 12
0
		public DateTimeExpression(PropertyType property, ValueOperator op, PropertyType value)
		{
			if (property == null)
				throw new ArgumentNullException("property");
			if (property.DataType != DataType.DateTime)
				throw GetWrongPropertyDataTypeException("property", DataType.DateTime);
			if (value == null)
				throw new ArgumentNullException("value");
			if (value.DataType != DataType.DateTime)
				throw GetWrongPropertyDataTypeException("value", DataType.DateTime);
			_binExp = new BinaryExpression(property, BinaryExpression.GetOperator(op), value);
		}
Esempio n. 13
0
        public void WriteDateTimeProperty(DateTime value, PropertyType type)
        {

            // provider-level hack to handle the "System.Data.SqlTypes.SqlDateTime.MinValue > System.DateTime.Minvalue
            object valueInDb;
            if ((value > SqlDateTime.MinValue.Value) && (value < SqlDateTime.MaxValue.Value))
                valueInDb = value;
            else
                valueInDb = DBNull.Value;

            WriteFlatProperty(
                type.Mapping,
                SqlProvider.DateTimePageSize,
                SqlProvider.DateTimeMappingPrefix,
                SqlDbType.DateTime,
                0,
                valueInDb);
        }
Esempio n. 14
0
			public void DeletePropertyType(PropertyType propertyType)
			{
				_target.GetType().GetMethod("DeletePropertyType").Invoke(_target, new object[] { propertyType });
			}
Esempio n. 15
0
			public void AddPropertyTypeToPropertySet(PropertyType propertyType, PropertySet owner, bool isDeclared)
			{
				_target.GetType().GetMethod("AddPropertyTypeToPropertySet").Invoke(_target, new object[] { propertyType, owner, isDeclared });
			}
Esempio n. 16
0
		internal abstract void RemovePropertyType(PropertyType propertyType);
Esempio n. 17
0
 public void WriteCurrencyProperty(decimal value, PropertyType type)
 {
     WriteFlatProperty(
         type.Mapping,
         SqlProvider.CurrencyPageSize,
         SqlProvider.CurrencyMappingPrefix,
         SqlDbType.Money,
         0,
         value);
 }
Esempio n. 18
0
		//================================================================================ Methods

		internal abstract void AddPropertyType(PropertyType propertyType);
Esempio n. 19
0
        // -------------------------------------------------------------- Remove commands

        private static void WriteDeletePropertyType(SchemaWriter writer, PropertyType propType)
        {
            writer.DeletePropertyType(propType);
        }
Esempio n. 20
0
        protected override PropertyMapping GetPropertyMappingInternal(PropertyType propType)
        {
            //internal const string StringMappingPrefix = "nvarchar_";
            //internal const string DateTimeMappingPrefix = "datetime_";
            //internal const string IntMappingPrefix = "int_";
            //internal const string CurrencyMappingPrefix = "money_";

            PropertyStorageSchema storageSchema = PropertyStorageSchema.SingleColumn;
            string tableName;
            string columnName;
            bool usePageIndex = false;
            int page = 0;

            switch (propType.DataType)
            {
                case DataType.String:
                    usePageIndex = true;
                    tableName = "FlatProperties";
                    columnName = SqlProvider.StringMappingPrefix + GetColumnIndex(propType.DataType, propType.Mapping, out page);
                    break;
                case DataType.Text:
                    usePageIndex = false;
                    tableName = "TextPropertiesNVarchar, TextPropertiesNText";
                    columnName = "Value";
                    storageSchema = PropertyStorageSchema.MultiTable;
                    break;
                case DataType.Int:
                    usePageIndex = true;
                    tableName = "FlatProperties";
                    columnName = SqlProvider.IntMappingPrefix + GetColumnIndex(propType.DataType, propType.Mapping, out page);
                    break;
                case DataType.Currency:
                    usePageIndex = true;
                    tableName = "FlatProperties";
                    columnName = SqlProvider.CurrencyMappingPrefix + GetColumnIndex(propType.DataType, propType.Mapping, out page);
                    break;
                case DataType.DateTime:
                    usePageIndex = true;
                    tableName = "FlatProperties";
                    columnName = SqlProvider.DateTimeMappingPrefix + GetColumnIndex(propType.DataType, propType.Mapping, out page);
                    break;
                case DataType.Binary:
                    usePageIndex = false;
                    tableName = "BinaryProperties";
                    columnName = "ContentType, FileNameWithoutExtension, Extension, Size, Stream";
                    storageSchema = PropertyStorageSchema.MultiColumn;
                    break;
                case DataType.Reference:
                    usePageIndex = false;
                    tableName = "ReferenceProperties";
                    columnName = "ReferredNodeId";
                    break;
                default:
                    throw new NotSupportedException("Unknown DataType" + propType.DataType);
            }
            return new PropertyMapping
            {
                StorageSchema = storageSchema,
                TableName = tableName,
                ColumnName = columnName,
                PageIndex = page,
                UsePageIndex = usePageIndex
            };
        }
Esempio n. 21
0
		/// <summary>
		/// When overridden in a derived class, removes the PropertyType from the owner PropertySet and resets the
		/// property values into all nodes instatiated by passed PropertySet.
		/// </summary>
		/// <param name="propertyType">PropertyType to remove</param>
		/// <param name="owner">Owner PropertySet</param>
		public abstract void RemovePropertyTypeFromPropertySet(PropertyType propertyType, PropertySet owner);
Esempio n. 22
0
		/// <summary>
		/// When overridden in a derived class, deletes an unused existing PropertyType
		/// </summary>
		/// <param name="propertyType">Unused existing PropertyType</param>
		public abstract void DeletePropertyType(PropertyType propertyType);
Esempio n. 23
0
			public void RemovePropertyTypeFromPropertySet(PropertyType propertyType, PropertySet owner)
			{
				_target.GetType().GetMethod("RemovePropertyTypeFromPropertySet").Invoke(_target, new object[] { propertyType, owner });
			}
Esempio n. 24
0
			public void UpdatePropertyTypeDeclarationState(PropertyType propertyType, NodeType owner, bool isDeclared)
			{
				_target.GetType().GetMethod("UpdatePropertyTypeDeclarationState").Invoke(_target, new object[] { propertyType, owner, isDeclared });
			}
Esempio n. 25
0
        //====================================================================== 

        internal static object LoadProperty(int versionId, PropertyType propertyType)
        {
            if (propertyType.DataType == DataType.Text)
                return DataProvider.Current.LoadTextPropertyValue(versionId, propertyType.Id);
            if (propertyType.DataType == DataType.Binary)
                return DataProvider.Current.LoadBinaryPropertyValue(versionId, propertyType.Id);
            return propertyType.DefaultValue;
        }
Esempio n. 26
0
		public Literal(PropertyType propertySlot) : base(propertySlot) { }
Esempio n. 27
0
		//============================ PropertyType assignment

		public abstract void AddPropertyTypeToPropertySet(PropertyType propertyType, PropertySet owner, bool isDeclared);
Esempio n. 28
0
		//================================================================================= Construction

		public BinaryExpression(PropertyType property, Operator op, object value)
		{
			_leftValue = new PropertyLiteral(property);
			_operator = op;
			_rightValue = new Literal(value);
		}
Esempio n. 29
0
		public abstract void UpdatePropertyTypeDeclarationState(PropertyType propertyType, NodeType owner, bool isDeclared);
Esempio n. 30
0
		public BinaryExpression(NodeAttribute property, Operator op, PropertyType value)
		{
			_leftValue = new PropertyLiteral(property);
			_operator = op;
			_rightValue = new Literal(value);
		}
Esempio n. 31
0
 private string CompilePropertySlot(PropertyType slot)
 {
     return slot.Name;
 }
Esempio n. 32
0
 private static void PropertyTypeReferenceToXml(PropertyType pt, StringBuilder sb, string indent)
 {
     sb.Append(indent).AppendLine(String.Format(CultureInfo.CurrentCulture, "<PropertyType name=\"{0}\" />", pt.Name));
 }