Exemplo n.º 1
0
		internal FieldMap(string member, string field, string nullValue, string parameter, PersistType persistType, Type memberType, CustomProvider provider)
			: base(member, field)
		{
			if (memberType == null) {
				throw new MappingException("Mapping: Field memberType was Missing - " + member);
			}
			this.persistType = persistType;
			this.memberType = memberType;

			if (nullValue == null) {
				this.nullValue = null;
			}
			else {
				// Jeff Lanning ([email protected]): Update to support null value expressions and make error message less ambiguous.
				try {
					this.nullValue = ConvertNullValue(nullValue, memberType);
				}
				catch (Exception ex) {
					throw new MappingException("Mapping: Failed to convert nullValue '" + nullValue + "' to type " + memberType.FullName + " for member '" + member + "'.", ex);
				}
			}
			if (parameter == null || parameter.Length == 0) {
				if (persistType != PersistType.Concurrent) {
					this.parameter = provider.GetParameterDefault(field);
				}
				else { // Concurrent Parameter Name Fix by Stephan Wagner (http://www.calac.net)
					this.parameter = provider.GetParameterDefault(member);
				}
			}
			else {
				this.parameter = parameter;
			}
		}
Exemplo n.º 2
0
		internal ManyMap(string member, string field, string type, string alias, string table, string source, string dest,
			bool queryOnly, bool lazy, bool cascade, string filter, string sortOrder, string selectSP, string insertSP, string deleteSP, CustomProvider provider)
			: base(Relationship.Many, member, field, type, alias, queryOnly, lazy, cascade, filter, sortOrder, selectSP, provider)
		{
			if (table == null || table.Length == 0) {
				throw new MappingException("Mapping: Relation table was Missing - " + member);
			}
			if (source == null || source.Length == 0) {
				throw new MappingException("Mapping: Relation sourceField was Missing - " + member);
			}
			if (dest == null || dest.Length == 0) {
				throw new MappingException("Mapping: Relation destField was Missing - " + member);
			}
			this.table = table;
			this.source = source.Replace(", ", ",").Split(',');
			this.dest = dest.Replace(", ", ",").Split(',');
			this.insertSP = insertSP;
			this.deleteSP = deleteSP;
			if (insertSP != null && insertSP.Length > 0 && deleteSP != null && deleteSP.Length > 0) {
				for (int index = 0; index < System.Math.Min(this.source.Length, this.dest.Length); index++) {
					this.source[index] = provider.GetParameterDefault(this.source[index]);
					this.dest[index] = provider.GetParameterDefault(this.dest[index]);
				}
			}
		}
Exemplo n.º 3
0
 internal ManyMap(string member, string field, string type, string alias, string table, string source, string dest,
                  bool queryOnly, bool lazy, bool cascade, string filter, string sortOrder, string selectSP, string insertSP, string deleteSP, CustomProvider provider)
     : base(Relationship.Many, member, field, type, alias, queryOnly, lazy, cascade, filter, sortOrder, selectSP, provider)
 {
     if (table == null || table.Length == 0)
     {
         throw new MappingException("Mapping: Relation table was Missing - " + member);
     }
     if (source == null || source.Length == 0)
     {
         throw new MappingException("Mapping: Relation sourceField was Missing - " + member);
     }
     if (dest == null || dest.Length == 0)
     {
         throw new MappingException("Mapping: Relation destField was Missing - " + member);
     }
     this.table    = table;
     this.source   = source.Replace(", ", ",").Split(',');
     this.dest     = dest.Replace(", ", ",").Split(',');
     this.insertSP = insertSP;
     this.deleteSP = deleteSP;
     if (insertSP != null && insertSP.Length > 0 && deleteSP != null && deleteSP.Length > 0)
     {
         for (int index = 0; index < System.Math.Min(this.source.Length, this.dest.Length); index++)
         {
             this.source[index] = provider.GetParameterDefault(this.source[index]);
             this.dest[index]   = provider.GetParameterDefault(this.dest[index]);
         }
     }
 }
Exemplo n.º 4
0
        internal RelationMap(Relationship relationship, string member, string field, string type, string alias, bool queryOnly,
                             bool lazy, bool cascade, string filter, string sortOrder, string selectSP, CustomProvider provider) : base(member, field)
        {
            if (type == null || type.Length == 0)
            {
                throw new MappingException("Mapping: Relation type was Missing");
            }
            if (alias == null || alias.Length == 0)               // Should never happend since alias defaults to member
            {
                throw new MappingException("Mapping: Relation alias was Missing");
            }

            this.fields       = field.Replace(", ", ",").Split(',');
            this.relationship = relationship;
            this.type         = type;
            this.alias        = alias;
            this.queryOnly    = queryOnly;
            this.lazy         = lazy;
            this.cascade      = cascade;
            this.filter       = filter;
            this.sortOrder    = sortOrder;
            this.selectSP     = selectSP;
            if (selectSP != null && selectSP.Length > 0)
            {
                for (int index = 0; index < this.fields.Length; index++)
                {
                    this.fields[index] = provider.GetParameterDefault(this.fields[index]);
                }
            }
        }
Exemplo n.º 5
0
        internal RelationMap(Relationship relationship, string member, string field, string type, string alias, bool queryOnly,
			bool lazy, bool cascade, string filter, string selectSP, CustomProvider provider)
            : base(member, field)
        {
            if (type == null || type.Length == 0) {
                throw new MappingException("Mapping: Relation type was Missing");
            }
            if (alias == null || alias.Length == 0) { // Should never happend since alias defaults to member
                throw new MappingException("Mapping: Relation alias was Missing");
            }

            this.fields = field.Replace(", ", ",").Split(',');
            this.relationship = relationship;
            this.type = type;
            this.alias = alias;
            this.queryOnly = queryOnly;
            this.lazy = lazy;
            this.cascade = cascade;
            this.filter = filter;
            this.selectSP = selectSP;
            if (selectSP != null && selectSP.Length > 0) {
                for (int index = 0; index < this.fields.Length; index++) {
                    this.fields[index] = provider.GetParameterDefault(this.fields[index]);
                }
            }
        }
Exemplo n.º 6
0
        internal FieldMap(string member, string field, string nullValue, string parameter, PersistType persistType, Type memberType, CustomProvider provider)
            : base(member, field)
        {
            if (memberType == null)
            {
                throw new MappingException("Mapping: Field memberType was Missing - " + member);
            }
            this.persistType = persistType;
            this.memberType  = memberType;

            if (nullValue == null)
            {
                this.nullValue = null;
            }
            else
            {
                // Jeff Lanning ([email protected]): Update to support null value expressions and make error message less ambiguous.
                try {
                    this.nullValue = ConvertNullValue(nullValue, memberType);
                }
                catch (Exception ex) {
                    throw new MappingException("Mapping: Failed to convert nullValue '" + nullValue + "' to type " + memberType.FullName + " for member '" + member + "'.", ex);
                }
            }
            if (parameter == null || parameter.Length == 0)
            {
                if (persistType != PersistType.Concurrent)
                {
                    this.parameter = provider.GetParameterDefault(field);
                }
                else                   // Concurrent Parameter Name Fix by Stephan Wagner (http://www.calac.net)
                {
                    this.parameter = provider.GetParameterDefault(member);
                }
            }
            else
            {
                this.parameter = parameter;
            }
        }