Ejemplo n.º 1
0
		/// <summary>
		/// Sets the properties.
		/// </summary>
		/// <param name="context"></param>
		/// <param name="dataspace"></param>
		/// <param name="attributes"></param>
		private void SetProperties(IMansionContext context, IPropertyBag dataspace, IEnumerable<KeyValuePair<string, object>> attributes)
		{
			// copy the attributes
			dataspace.Merge(attributes);

			// execute children
			ExecuteChildTags(context);
		}
		/// <summary>
		/// Maps the given <paramref name="dbRecord"/> to <paramref name="properties"/>.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="dbRecord">The <see cref="DbRecord"/> which to map.</param>
		/// <param name="properties">The <see cref="IPropertyBag"/> in which to store the mapped result.</param>
		protected override void DoMap(IMansionContext context, DbRecord dbRecord, IPropertyBag properties)
		{
			// get the index of the column
			var extendedPropertiesIndex = dbRecord.GetOrdinal("extendedProperties");

			// check if there are no extended properties
			if (dbRecord.IsDBNull(extendedPropertiesIndex))
				return;

			// get the extended properties
			var extendedPropertiesLength = dbRecord.GetBytes(extendedPropertiesIndex, 0, null, 0, 0);
			var serializedProperties = new byte[extendedPropertiesLength];
			dbRecord.GetBytes(extendedPropertiesIndex, 0, serializedProperties, 0, serializedProperties.Length);

			// deserialize
			var deserializedProperties = conversionService.Convert<IPropertyBag>(context, serializedProperties);

			// merge the deserialized properties
			properties.Merge(deserializedProperties);
		}