Example #1
0
		internal EntityMap(string type, EntityMap baseEntity, string typeValue) {
			if (type == null || type.Length == 0) {
				throw new MappingException("Mapping: SubEntity type was Missing");
			}
			if (baseEntity == null) {
				throw new MappingException("Mapping: SubEntity inherits was undefined Entity - " + type);
			}
			if (baseEntity.TypeField == null || baseEntity.TypeField.Length == 0) {
				throw new MappingException("Mapping: SubEntity entity had undefined typeField - " + type);
			}
			if (typeValue == null || typeValue.Length == 0) {
				throw new MappingException("Mapping: SubEntity typeValue was not defined - " + type);
			}
			
			this.type = type;
			this.table = baseEntity.table;
			this.keyMembers = baseEntity.keyMembers.Clone() as string[];
			this.keyType = baseEntity.keyType;
			this.sortOrder = baseEntity.sortOrder;
			this.readOnly = baseEntity.readOnly;
			this.changesOnly = baseEntity.changesOnly;
			this.autoTrack = baseEntity.autoTrack;
			this.hint = baseEntity.hint;
			
			this.baseEntity = baseEntity;
			this.typeField = baseEntity.typeField;
			try {
				if (typeValue == null) {
					this.typeValue = null;
				}
				else {
					this.typeValue = int.Parse(typeValue);
				}
			}
			catch {
				this.typeValue = typeValue.Trim('\'');
			}
			baseEntity.AddSubType(this.typeValue.ToString(), type);

			this.insertSP = baseEntity.insertSP;
			this.updateSP = baseEntity.updateSP;
			this.deleteSP = baseEntity.deleteSP;
			this.readOnlyCount = baseEntity.readOnlyCount;
			this.concurrentCount = baseEntity.concurrentCount;
			
			this.fields = baseEntity.fields.Clone() as FieldMap[];
			this.keyFields = baseEntity.keyFields.Clone() as FieldMap[];
			this.relations = baseEntity.relations.Clone() as RelationMap[];
			this.members = baseEntity.members.Clone() as Hashtable;
			this.helper = baseEntity.helper.Clone() as Hashtable;

			if (EntityMap.GetType(this.type) == null) {
				throw new MappingException("Mapping: Entity type was Invalid - " + type);
			}
			if (EntityMap.GetType(this.type).GetInterface(typeof(IObjectHelper).ToString()) != null) {
				this.hasHelper = true;
			}
			if (EntityMap.GetType(this.type).GetInterface(typeof(IObjectNotification).ToString()) != null) {
				this.hasEvents = true;
			}
		}
Example #2
0
        internal EntityMap(string type, EntityMap baseEntity, string typeValue)
        {
            if (type == null || type.Length == 0)
            {
                throw new MappingException("Mapping: SubEntity type was Missing");
            }
            if (baseEntity == null)
            {
                throw new MappingException("Mapping: SubEntity inherits was undefined Entity - " + type);
            }
            if (baseEntity.TypeField == null || baseEntity.TypeField.Length == 0)
            {
                throw new MappingException("Mapping: SubEntity entity had undefined typeField - " + type);
            }
            if (typeValue == null || typeValue.Length == 0)
            {
                throw new MappingException("Mapping: SubEntity typeValue was not defined - " + type);
            }

            this.type        = type;
            this.table       = baseEntity.table;
            this.keyMembers  = baseEntity.keyMembers.Clone() as string[];
            this.keyType     = baseEntity.keyType;
            this.sortOrder   = baseEntity.sortOrder;
            this.readOnly    = baseEntity.readOnly;
            this.changesOnly = baseEntity.changesOnly;
            this.autoTrack   = baseEntity.autoTrack;
            this.hint        = baseEntity.hint;

            this.baseEntity = baseEntity;
            this.typeField  = baseEntity.typeField;
            try {
                if (typeValue == null)
                {
                    this.typeValue = null;
                }
                else
                {
                    this.typeValue = int.Parse(typeValue);
                }
            }
            catch {
                this.typeValue = typeValue.Trim('\'');
            }
            baseEntity.AddSubType(this.typeValue.ToString(), type);

            this.insertSP        = baseEntity.insertSP;
            this.updateSP        = baseEntity.updateSP;
            this.deleteSP        = baseEntity.deleteSP;
            this.readOnlyCount   = baseEntity.readOnlyCount;
            this.concurrentCount = baseEntity.concurrentCount;

            this.fields    = baseEntity.fields.Clone() as FieldMap[];
            this.keyFields = baseEntity.keyFields.Clone() as FieldMap[];
            this.relations = baseEntity.relations.Clone() as RelationMap[];
            this.members   = baseEntity.members.Clone() as Hashtable;
            this.helper    = baseEntity.helper.Clone() as Hashtable;

            if (EntityMap.GetType(this.type) == null)
            {
                throw new MappingException("Mapping: Entity type was Invalid - " + type);
            }
            if (EntityMap.GetType(this.type).GetInterface(typeof(IObjectHelper).ToString()) != null)
            {
                this.hasHelper = true;
            }
            if (EntityMap.GetType(this.type).GetInterface(typeof(IObjectNotification).ToString()) != null)
            {
                this.hasEvents = true;
            }
        }