Пример #1
0
 /// <summary>
 /// Creates Mapped property
 /// </summary>
 /// <param name="aAdaptor">
 /// Adaptor mapped property is connected to <see cref="IAdaptor"/>
 /// </param>
 /// <param name="aIsColumn">
 /// Defines if this is column or not <see cref="System.Boolean"/>
 /// </param>
 /// <param name="aName">
 /// Name of mapped property <see cref="System.String"/>
 /// </param>
 /// <param name="aColumnName">
 /// Name of column <see cref="System.String"/>
 /// </param>
 /// <param name="aRWFlags">
 /// Read write flags <see cref="EReadWrite"/>
 /// </param>
 /// <param name="aSubItems">
 /// Sub items <see cref="SMappedItem"/>
 /// </param>
 public MappedProperty(IAdaptor aAdaptor, bool aIsColumn, string aName, string aColumnName,
                       EReadWrite aRWFlags, SMappedItem[] aSubItems)
 {
     // Column Mapped property
     if (aAdaptor == null)
     {
         throw new ExceptionMappedPropertyWithNullAdaptor();
     }
     submappings = new ChildMappedProperties();
     adaptor     = new WeakReference(aAdaptor);
     if (Adaptor.IsBoundaryAdaptor == true)
     {
         throw new ExceptionNonBoundaryMappingSetToBoundary(aName, true, aColumnName);
     }
     Name            = aName;
     IsColumnMapping = aIsColumn;
     originalRWFlags = aRWFlags;
     RWFlags         = aRWFlags;
     if (IsColumnMapping == true)
     {
         submappings = new ChildMappedProperties();
     }
     if (aSubItems != null)
     {
         Submappings.Size = aSubItems.Length;
         foreach (SMappedItem item in aSubItems)
         {
             Submappings.AddMapping(new MappedProperty(this, item));
         }
     }
     ColumnName = aColumnName;
     Resolve();
 }
Пример #2
0
 /// <summary>
 /// Disconnects on adaptors OnTargetChange
 /// </summary>
 public void Disconnect()
 {
     if (dataCache != null)
     {
         dataCache.Disconnect();
     }
     dataCache = null;
     if (controlCache != null)
     {
         controlCache.Disconnect();
     }
     controlCache = null;
     if (IsSubItem == true)
     {
         MasterItem.Submappings.RemoveMapping(this);
     }
     else
     if (submappings != null)
     {
         submappings.Disconnect();
     }
     submappings = null;
     masterItem  = null;
     if (Adaptor != null)
     {
         Adaptor.TargetChanged -= TargetChanged;
         adaptor.Target         = null;
     }
     adaptor = null;
 }
Пример #3
0
 /// <summary>
 /// Creates Mapped property
 /// </summary>
 /// <param name="aAdaptor">
 /// Adaptor mapped property is connected to <see cref="IAdaptor"/>
 /// </param>
 /// <param name="aIsColumn">
 /// Defines if this is column or not <see cref="System.Boolean"/>
 /// </param>
 /// <param name="aName">
 /// Name of mapped property <see cref="System.String"/>
 /// </param>
 /// <param name="aColumnName">
 /// Name of column <see cref="System.String"/>
 /// </param>
 /// <param name="aRWFlags">
 /// Read write flags <see cref="EReadWrite"/>
 /// </param>
 /// <param name="aTarget">
 /// Target mapping <see cref="System.String"/>
 /// </param>
 /// <param name="aSubItems">
 /// Sub items <see cref="SMappedItem"/>
 /// </param>
 public MappedProperty(IAdaptor aAdaptor, bool aIsColumn, string aName, string aColumnName, EReadWrite aRWFlags,
                       string aTarget, SMappedItem[] aSubItems)
 {
     // Targeted Column Mapped property
     if (aAdaptor == null)
     {
         throw new ExceptionMappedPropertyWithNullAdaptor();
     }
     adaptor = new WeakReference(aAdaptor);
     if (Adaptor.IsBoundaryAdaptor == true)
     {
         throw new ExceptionNonBoundaryMappingSetToBoundary(aName, aTarget, aColumnName);
     }
     Name            = aName;
     submappings     = new ChildMappedProperties();
     mappingTarget   = aTarget;
     IsColumnMapping = aIsColumn;
     if (IsColumnMapping == true)
     {
         submappings = new ChildMappedProperties();
     }
     ColumnName      = aColumnName;
     originalRWFlags = aRWFlags;
     RWFlags         = aRWFlags;
     if (aSubItems != null)
     {
         foreach (SMappedItem item in aSubItems)
         {
             Submappings.AddMapping(new MappedProperty(this, item));
         }
     }
     if (aTarget == "")
     {
         throw new ExceptionMappingRequiresDefinedTarget(aName);
     }
     Resolve();
 }
		/// <summary>
		/// Creates Mapped property
		/// </summary>
		/// <param name="aAdaptor">
		/// Adaptor mapped property is connected to <see cref="IAdaptor"/>
		/// </param>
		/// <param name="aIsColumn">
		/// Defines if this is column or not <see cref="System.Boolean"/>
		/// </param>
		/// <param name="aName">
		/// Name of mapped property <see cref="System.String"/>
		/// </param>
		/// <param name="aColumnName">
		/// Name of column <see cref="System.String"/>
		/// </param>
		/// <param name="aRWFlags">
		/// Read write flags <see cref="EReadWrite"/>
		/// </param>
		/// <param name="aTarget">
		/// Target mapping <see cref="System.String"/>
		/// </param>
		/// <param name="aSubItems">
		/// Sub items <see cref="SMappedItem"/>
		/// </param>
		public MappedProperty (IAdaptor aAdaptor, bool aIsColumn, string aName, string aColumnName, EReadWrite aRWFlags, 
		                       string aTarget, SMappedItem[] aSubItems)
		{
			// Targeted Column Mapped property
			if (aAdaptor == null)
				throw new ExceptionMappedPropertyWithNullAdaptor();
			adaptor = new WeakReference (aAdaptor);
			if (Adaptor.IsBoundaryAdaptor == true)
				throw new ExceptionNonBoundaryMappingSetToBoundary (aName, aTarget, aColumnName); 
			Name = aName;
			submappings = new ChildMappedProperties();
			mappingTarget = aTarget;
			IsColumnMapping = aIsColumn;
			if (IsColumnMapping == true)
				submappings = new ChildMappedProperties();
			ColumnName = aColumnName;
			originalRWFlags = aRWFlags;
			RWFlags = aRWFlags;
			if (aSubItems != null)
				foreach (SMappedItem item in aSubItems)
					Submappings.AddMapping (new MappedProperty (this, item));
			if (aTarget == "")
				throw new ExceptionMappingRequiresDefinedTarget (aName); 
			Resolve();
		}
		/// <summary>
		/// Creates Mapped property
		/// </summary>
		/// <param name="aAdaptor">
		/// Adaptor mapped property is connected to <see cref="IAdaptor"/>
		/// </param>
		/// <param name="aIsColumn">
		/// Defines if this is column or not <see cref="System.Boolean"/>
		/// </param>
		/// <param name="aName">
		/// Name of mapped property <see cref="System.String"/>
		/// </param>
		/// <param name="aColumnName">
		/// Name of column <see cref="System.String"/>
		/// </param>
		/// <param name="aRWFlags">
		/// Read write flags <see cref="EReadWrite"/>
		/// </param>
		/// <param name="aSubItems">
		/// Sub items <see cref="SMappedItem"/>
		/// </param>
		public MappedProperty (IAdaptor aAdaptor, bool aIsColumn, string aName, string aColumnName, 
		                       EReadWrite aRWFlags, SMappedItem[] aSubItems)
		{
			// Column Mapped property
			if (aAdaptor == null)
				throw new ExceptionMappedPropertyWithNullAdaptor();
			submappings = new ChildMappedProperties();
			adaptor = new WeakReference (aAdaptor);
			if (Adaptor.IsBoundaryAdaptor == true)
				throw new ExceptionNonBoundaryMappingSetToBoundary (aName, true, aColumnName); 
			Name = aName;
			IsColumnMapping = aIsColumn;
			originalRWFlags = aRWFlags;
			RWFlags = aRWFlags;
			if (IsColumnMapping == true)
				submappings = new ChildMappedProperties();
			if (aSubItems != null) {
				Submappings.Size = aSubItems.Length;
				foreach (SMappedItem item in aSubItems)
					Submappings.AddMapping (new MappedProperty (this, item));
			}
			ColumnName = aColumnName;
			Resolve();
		}
		/// <summary>
		/// Disconnects on adaptors OnTargetChange
		/// </summary>
		public void Disconnect()
		{
			if (dataCache != null)
				dataCache.Disconnect();
			dataCache = null;
			if (controlCache != null)
				controlCache.Disconnect();
			controlCache = null;
			if (IsSubItem == true)
				MasterItem.Submappings.RemoveMapping (this);
			else
				if (submappings != null)
					submappings.Disconnect();
			submappings = null;
			masterItem = null;
			if (Adaptor != null)
			{
				Adaptor.TargetChanged -= TargetChanged;
				adaptor.Target = null;
			}
			adaptor = null;
		}