Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates Mapped property
 /// </summary>
 /// <param name="aAdaptor">
 /// Adaptor mapped property is connected to <see cref="IAdaptor"/>
 /// </param>
 /// <param name="aName">
 /// Name of mapped property <see cref="System.String"/>
 /// </param>
 public MappedProperty(IAdaptor aAdaptor, string aName)
 {
     // Default Mapped property
     if (aAdaptor == null)
     {
         throw new ExceptionMappedPropertyWithNullAdaptor();
     }
     adaptor = new WeakReference(aAdaptor);
     if (Adaptor.IsBoundaryAdaptor == true)
     {
         throw new ExceptionNonBoundaryMappingSetToBoundary(aName);
     }
     Name            = aName;
     RWFlags         = EReadWrite.ReadWrite;
     originalRWFlags = RWFlags;
     Resolve();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates Mapped property
        /// </summary>
        /// <param name="aMasterItem">
        /// Master item <see cref="MappedProperty"/>
        /// </param>
        /// <param name="aItem">
        /// Item <see cref="SMappedItem"/>
        /// </param>
        public MappedProperty(MappedProperty aMasterItem, SMappedItem aItem)
        {
            if (aMasterItem == null)
            {
                throw new ExceptionMasterItemIsNull();
            }
            masterItem = aMasterItem;
            isSubItem  = true;
            adaptor    = new WeakReference(masterItem.Adaptor);

/*			if (Adaptor.IsBoundaryAdaptor == true)
 *                              throw new Exception ("You can't set Boundary Mapping to non-Boundary adaptor >> Name=" + aItem.Name + " Target=" + aItem.MappedItem);*/
            Name = aItem.Name;
            BoundingClassName = aItem.ClassName;
            mappingTarget     = aItem.MappedItem;
            originalRWFlags   = aItem.RWFlags;
            RWFlags           = aItem.RWFlags;
//			aMasterItem.Submappings.AddMapping(this);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates Mapped property
 /// </summary>
 /// <param name="aAdaptor">
 /// Adaptor mapped property is connected to <see cref="IAdaptor"/>
 /// </param>
 /// <param name="aName">
 /// Name of mapped property <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>
 public MappedProperty(IAdaptor aAdaptor, string aName, EReadWrite aRWFlags, string aTarget)
 {
     // Secondary Mapped property
     if (aAdaptor == null)
     {
         throw new ExceptionMappedPropertyWithNullAdaptor();
     }
     adaptor = new WeakReference(aAdaptor);
     if (Adaptor.IsBoundaryAdaptor == true)
     {
         throw new ExceptionNonBoundaryMappingSetToBoundary(aName, aTarget);
     }
     Name            = aName;
     mappingTarget   = aTarget;
     originalRWFlags = aRWFlags;
     RWFlags         = aRWFlags;
     if (aTarget == "")
     {
         throw new ExceptionMappingRequiresDefinedTarget(aName);
     }
     Resolve();
 }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
0
		/// <summary>
		/// Adds new mapping
		/// </summary>
		/// <param name="aName">
		/// Mapping name <see cref="System.String"/>
		/// </param>
		/// <param name="aType">
		/// Type of mapping <see cref="System.Type"/>
		/// </param>
		/// <param name="aRW">
		/// Read-write settings for mapped property <see cref="EReadWrite"/>
		/// </param>
		/// <param name="aClassName">
		/// Defines class name <see cref="System.String"/>
		/// </param>
		/// <param name="aIsColumn">
		/// Defines if mapping is coumn mapping or not <see cref="System.Boolean"/>
		/// </param>
		/// <param name="aColumnName">
		/// Name of column <see cref="System.String"/>
		/// </param>
		/// <param name="aMapping">
		/// Mapping string <see cref="System.String"/>
		/// </param>
		/// <param name="aSubItems">
		/// List of subitems <see cref="SMappedItem"/>
		/// </param>
		/// <returns>
		/// Returns true if successful <see cref="System.Boolean"/>
		/// </returns>
		public bool AddMapping (string aName, System.Type aType, EReadWrite aRW, string aClassName, bool aIsColumn, 
		                        string aColumnName, string aMapping, SMappedItem[] aSubItems)
		{
			cachedMappings = false;
			MappedProperty mp = Values[aName];
			if (mp != null) {
				// There is one case when duplicate is allowed, if there is only one as global and
				// only one as default
				bool found = false;
				foreach (MappedProperty mpr in Values)
					if ((mpr.Name == aName) && (mpr.IsColumnMapping == aIsColumn))
						found = true;
				if (found == false)
					mp = null;
			}
			if (mp != null) {
				if (mp.BoundingClassName != aClassName)
					mp.BoundingClassName = aClassName;
				if (mp.IsColumnMapping != aIsColumn)
					mp.IsColumnMapping = aIsColumn;
				if (mp.ColumnName != aColumnName)
					mp.ColumnName = aColumnName;
				if (mp.MappingTarget != aMapping)
					mp.MappingTarget = aMapping;
				mp = null;
				throw new ExceptionAddWrongMapping();
			}
			
			if (aName == "")
				throw new ExceptionAddEmptyMapping();

			isValidated = false;
			if (IsBoundaryAdaptor == true)
				if (aClassName != "")
					mappingList.Add (new MappedProperty (this, aClassName, aName, aRW, aMapping));
				else
					mappingList.Add (new MappedProperty (this, aName, aRW, aMapping));
			else
				if ((aIsColumn == true) && (aColumnName != ""))
					if (aMapping == "")
						mappingList.Add (new MappedProperty (this, true, aName, aColumnName, aRW, aSubItems));
					else
						mappingList.Add (new MappedProperty (this, true, aName, aColumnName, aRW, aMapping, aSubItems));
				else
					if (aMapping == "") 
						mappingList.Add (new MappedProperty (this, aName));
					else
						mappingList.Add (new MappedProperty (this, aName, aRW, aMapping));

			if (HasDefaultMapping == false) 
				hasDefaultMapping = (GetDefaultProperty() != null);
			return (true);
		}
		/// <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>
		/// Creates Mapped property
		/// </summary>
		/// <param name="aAdaptor">
		/// Adaptor mapped property is connected to <see cref="IAdaptor"/>
		/// </param>
		/// <param name="aName">
		/// Name of mapped property <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>
		public MappedProperty (IAdaptor aAdaptor, string aName, EReadWrite aRWFlags, string aTarget)
		{
			// Secondary Mapped property
			if (aAdaptor == null)
				throw new ExceptionMappedPropertyWithNullAdaptor();
			adaptor = new WeakReference (aAdaptor);
			if (Adaptor.IsBoundaryAdaptor == true)
				throw new ExceptionNonBoundaryMappingSetToBoundary (aName, aTarget); 
			Name = aName;
			mappingTarget = aTarget;
			originalRWFlags = aRWFlags;
			RWFlags = aRWFlags;
			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="aName">
		/// Name of mapped property <see cref="System.String"/>
		/// </param>
		public MappedProperty (IAdaptor aAdaptor, string aName)
		{
			// Default Mapped property
			if (aAdaptor == null)
				throw new ExceptionMappedPropertyWithNullAdaptor();
			adaptor = new WeakReference (aAdaptor);
			if (Adaptor.IsBoundaryAdaptor == true)
				throw new ExceptionNonBoundaryMappingSetToBoundary (aName);
			Name = aName;
			RWFlags = EReadWrite.ReadWrite;
			originalRWFlags = RWFlags;
			Resolve();
		}
		/// <summary>
		/// Creates Mapped property
		/// </summary>
		/// <param name="aMasterItem">
		/// Master item <see cref="MappedProperty"/>
		/// </param>
		/// <param name="aItem">
		/// Item <see cref="SMappedItem"/>
		/// </param>
		public MappedProperty (MappedProperty aMasterItem, SMappedItem aItem)
		{
			if (aMasterItem == null)
				throw new ExceptionMasterItemIsNull();
			masterItem = aMasterItem;
			isSubItem = true;
			adaptor = new WeakReference (masterItem.Adaptor);
/*			if (Adaptor.IsBoundaryAdaptor == true)
				throw new Exception ("You can't set Boundary Mapping to non-Boundary adaptor >> Name=" + aItem.Name + " Target=" + aItem.MappedItem);*/ 
			Name = aItem.Name;
			BoundingClassName = aItem.ClassName;
			mappingTarget = aItem.MappedItem;
			originalRWFlags = aItem.RWFlags;
			RWFlags = aItem.RWFlags;
//			aMasterItem.Submappings.AddMapping(this);
		}
Ejemplo n.º 12
0
 /// <summary>
 /// Converts EReadWrite to PropertyDefinition
 /// </summary>
 /// <param name="aState">
 /// State <see cref="EReadWrite"/>
 /// </param>
 /// <returns>
 /// PropertyDefinition state which equals original state <see cref="PropertyDefinition"/>
 /// </returns>
 public static PropertyDefinition GetPropertyDefinition(this EReadWrite aState)
 {
     return((aState == EReadWrite.ReadWrite) ? PropertyDefinition.ReadWrite : PropertyDefinition.ReadOnly);
 }