protected SqlQueryInfo CreateUpdateSqlText(DbManager db, Type type) { TypeExtension typeExt = TypeExtension.GetTypeExtension(type, Extensions); ObjectMapper om = db.MappingSchema.GetObjectMapper(type); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); MetadataProviderBase mp = MappingSchema.MetadataProvider; sb.AppendFormat("UPDATE\n\t{0}\nSET\n", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); foreach (MemberMapper mm in GetFieldList(om)) { bool isSet; if (!mp.GetNonUpdatableFlag(type, typeExt, mm.MemberAccessor, out isSet) || !isSet) { SqlQueryParameterInfo p = query.AddParameter( db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0} = {1},\n", db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField), p.ParameterName); } } sb.Remove(sb.Length - 2, 1); AddWherePK(db, query, sb); query.QueryText = sb.ToString(); return(query); }
private void AddWherePK(DbManager db, SqlQueryInfo query, StringBuilder sb, int nParameter, FullObjectMapper mapper) { sb.Append("WHERE\n"); foreach (IMapper mm in mapper.PropertiesMapping) { if (mm is ValueMapper && mm.DataReaderIndex == mapper.DataReaderIndex) { var valueMapper = (ValueMapper)mm; string tableAlias = mapper.PropertyType.Name; //mm.Name = ID_TRACK SqlQueryParameterInfo p = query.AddParameter( db.DataProvider.Convert(valueMapper.ColumnName + "_W", ConvertType.NameToQueryParameter). ToString(), valueMapper.ColumnName); sb.AppendFormat("\t{0}.{1} = ", "T" /* tableAlias */, db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField)); if (nParameter < 0) { sb.AppendFormat("{0} AND\n", p.ParameterName); } else { sb.AppendFormat("{{{0}}} AND\n", nParameter++); } } } sb.Remove(sb.Length - 5, 5); }
protected SqlQueryInfo CreateInsertSqlText(DbManager db, Type type, int nParameter) { TypeExtension typeExt = TypeExtension.GetTypeExtension(type, Extensions); ObjectMapper om = db.MappingSchema.GetObjectMapper(type); List <MemberMapper> list = new List <MemberMapper>(); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); MetadataProviderBase mp = MappingSchema.MetadataProvider; sb.Append("INSERT INTO "); AppendTableName(sb, db, type); sb.Append(" (\n"); foreach (MemberMapper mm in GetFieldList(om)) { // IT: This works incorrectly for complex mappers. // // [2009-03-24] ili: use mm.MemberAccessor instead of mm.ComplexMemberAccessor // as in CreateUpdateSqlText // bool isSet; if (mp.GetNonUpdatableAttribute(type, typeExt, mm.MapMemberInfo.MemberAccessor, out isSet) == null || !isSet) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); list.Add(mm); } } sb.Remove(sb.Length - 2, 1); sb.Append(") VALUES (\n"); foreach (MemberMapper mm in list) { SqlQueryParameterInfo p = query.AddParameter( db.DataProvider.Convert(mm.Name + "_P", ConvertType.NameToQueryParameter).ToString(), mm.Name); if (nParameter < 0) { sb.AppendFormat("\t{0},\n", p.ParameterName); } //sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(p.ParameterName, ConvertType.NameToQueryParameter)); else { sb.AppendFormat("\t{{{0}}},\n", nParameter++); } } sb.Remove(sb.Length - 2, 1); sb.Append(")"); query.QueryText = sb.ToString(); return(query); }
protected virtual void AddWherePK(DbManager db, SqlQueryInfo query, StringBuilder sb, int nParameter) { sb.Append("WHERE\n"); var memberMappers = GetKeyFieldList(db, query.ObjectType); if (memberMappers.Length == 0) { throw new DataAccessException( string.Format("No primary key field(s) in the type '{0}'.", query.ObjectType.FullName)); } foreach (var mm in memberMappers) { var p = query.AddParameter( db.DataProvider.Convert(mm.Name + "_W", ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0} = ", db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField)); if (nParameter < 0) { sb.AppendFormat("{0} AND\n", p.ParameterName); } else { sb.AppendFormat("{{{0}}} AND\n", nParameter++); } } sb.Remove(sb.Length - 5, 5); }
protected SqlQueryInfo CreateSelectByKeySqlText(DbManager db, Type type) { var om = db.MappingSchema.GetObjectMapper(type); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); sb.Append("SELECT\n"); foreach (var mm in GetFieldList(om)) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); } sb.Remove(sb.Length - 2, 1); sb.Append("FROM\n\t"); AppendTableName(sb, db, type); AddWherePK(db, query, sb, -1); query.QueryText = sb.ToString(); return(query); }
public virtual System.Collections.Generic.List <T> SelectAll <T>(DbManager db) { SqlQueryInfo query = GetSqlQueryInfo(db, typeof(T), "SelectAll"); return(db .SetCommand(query.QueryText) .ExecuteList <T>()); }
public virtual int DeleteByKey(DbManager db, params object[] key) { SqlQueryInfo query = GetSqlQueryInfo(db, typeof(T), "Delete"); return(db .SetCommand(query.QueryText, query.GetParameters(db, key)) .ExecuteNonQuery()); }
public virtual int Delete(DbManager db, T obj) { SqlQueryInfo query = GetSqlQueryInfo(db, obj.GetType(), "Delete"); return(db .SetCommand(query.QueryText, query.GetParameters(db, obj)) .ExecuteNonQuery()); }
public virtual T SelectByKey(DbManager db, params object[] keys) { SqlQueryInfo query = GetSqlQueryInfo(db, typeof(T), "SelectByKey"); return(db .SetCommand(query.QueryText, query.GetParameters(db, keys)) .ExecuteObject <T>()); }
public virtual IList SelectAll(DbManager db, IList list, Type type) { SqlQueryInfo query = GetSqlQueryInfo(db, type, "SelectAll"); return(db .SetCommand(query.QueryText) .ExecuteList(list, type)); }
public virtual List <T> SelectAll(DbManager db) { SqlQueryInfo query = GetSqlQueryInfo(db, typeof(T), "SelectAll"); return(db .SetCommand(query.QueryText) .ExecuteList <T>()); }
public virtual L SelectAll <L>(DbManager db, L list) where L : IList <T> { SqlQueryInfo query = GetSqlQueryInfo(db, typeof(T), "SelectAll"); return(db .SetCommand(query.QueryText) .ExecuteList <L, T>(list)); }
public virtual SqlQueryInfo GetSqlQueryInfo(DbManager db, Type type, string actionName) { string key = type.FullName + "$" + actionName + "$" + db.DataProvider.UniqueName + "$" + GetTableName(type); SqlQueryInfo query = (SqlQueryInfo)_actionSqlQueryInfo[key]; if (query == null) { query = CreateSqlText(db, type, actionName); _actionSqlQueryInfo[key] = query; } return(query); }
public virtual int Delete(DbManager db, int maxBatchSize, IEnumerable <T> list) { SqlQueryInfo query = GetSqlQueryInfo(db, typeof(T), "DeleteBatch"); db.SetCommand(query.QueryText); return(ExecuteForEach( db, list, query.GetMemberMappers(), maxBatchSize, delegate(T obj) { return query.GetParameters(db, obj); })); }
protected SqlQueryInfo CreateDeleteSqlText(DbManager db, Type type) { ObjectMapper om = db.MappingSchema.GetObjectMapper(type); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); sb.AppendFormat("DELETE FROM\n\t{0}\n", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); AddWherePK(db, query, sb); query.QueryText = sb.ToString(); return(query); }
protected SqlQueryInfo CreateDeleteSqlText(DbManager db, Type type, int nParameter) { var om = db.MappingSchema.GetObjectMapper(type); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); sb.Append("DELETE FROM\n\t"); AppendTableName(sb, db, type); sb.AppendLine(); AddWherePK(db, query, sb, nParameter); query.QueryText = sb.ToString(); return(query); }
protected SqlQueryInfo CreateInsertSqlText(DbManager db, Type type) { TypeExtension typeExt = TypeExtension.GetTypeExtension(type, Extensions); ObjectMapper om = db.MappingSchema.GetObjectMapper(type); List <MemberMapper> list = new List <MemberMapper>(); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); MetadataProviderBase mp = MappingSchema.MetadataProvider; sb.AppendFormat("INSERT INTO {0} (\n", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); foreach (MemberMapper mm in GetFieldList(om)) { // IT: This works incorrectly for complex mappers. // bool isSet; if (!mp.GetNonUpdatableFlag(type, typeExt, mm.ComplexMemberAccessor, out isSet) || !isSet) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); list.Add(mm); } } sb.Remove(sb.Length - 2, 1); sb.Append(") VALUES (\n"); foreach (MemberMapper mm in list) { SqlQueryParameterInfo p = query.AddParameter( db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0},\n", p.ParameterName); } sb.Remove(sb.Length - 2, 1); sb.Append(")"); query.QueryText = sb.ToString(); return(query); }
protected SqlQueryInfo CreateSelectAllSqlText(DbManager db, Type type) { ObjectMapper om = db.MappingSchema.GetObjectMapper(type); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); sb.Append("SELECT\n"); foreach (MemberMapper mm in GetFieldList(om)) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); } sb.Remove(sb.Length - 2, 1); sb.AppendFormat("FROM\n\t{0}", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); query.QueryText = sb.ToString(); return(query); }
protected SqlQueryInfo CreateInsertSqlText(DbManager db, Type type, int nParameter) { var typeExt = TypeExtension.GetTypeExtension(type, Extensions); var om = db.MappingSchema.GetObjectMapper(type); var list = new List<MemberMapper>(); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); var mp = MappingSchema.MetadataProvider; sb.Append("INSERT INTO "); AppendTableName(sb, db, type); sb.Append(" (\n"); foreach (var mm in GetFieldList(om)) { // IT: This works incorrectly for complex mappers. // // [2009-03-24] ili: use mm.MemberAccessor instead of mm.ComplexMemberAccessor // as in CreateUpdateSqlText // bool isSet; var nonUpdatableAttribute = mp.GetNonUpdatableAttribute(type, typeExt, mm.MapMemberInfo.MemberAccessor, out isSet); if (nonUpdatableAttribute == null || !isSet || nonUpdatableAttribute.OnInsert == false) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); list.Add(mm); } } sb.Remove(sb.Length - 2, 1); sb.Append(") VALUES (\n"); foreach (var mm in list) { var p = query.AddParameter( db.DataProvider.Convert(mm.Name + "_P", ConvertType.NameToQueryParameter).ToString(), mm.Name); if (nParameter < 0) sb.AppendFormat("\t{0},\n", p.ParameterName); //sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(p.ParameterName, ConvertType.NameToQueryParameter)); else sb.AppendFormat("\t{{{0}}},\n", nParameter++); } sb.Remove(sb.Length - 2, 1); sb.Append(")"); query.QueryText = sb.ToString(); return query; }
protected SqlQueryInfo CreateUpdateSqlText(DbManager db, Type type, int nParameter) { var typeExt = TypeExtension.GetTypeExtension(type, Extensions); var om = db.MappingSchema.GetObjectMapper(type); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); var mp = MappingSchema.MetadataProvider; sb.Append("UPDATE\n\t"); AppendTableName(sb, db, type); sb.Append("\nSET\n"); var fields = GetFieldList(om); var hasFields = false; foreach (var mm in fields) { bool isSet; var nonUpdatableAttribute = mp.GetNonUpdatableAttribute(type, typeExt, mm.MapMemberInfo.MemberAccessor, out isSet); if (nonUpdatableAttribute != null && isSet && nonUpdatableAttribute.OnUpdate == true) { continue; } mp.GetPrimaryKeyOrder(type, typeExt, mm.MapMemberInfo.MemberAccessor, out isSet); if (isSet) { continue; } hasFields = true; var p = query.AddParameter( db.DataProvider.Convert(mm.Name + "_P", ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0} = ", db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField)); if (nParameter < 0) { sb.AppendFormat("{0},\n", p.ParameterName); } else { sb.AppendFormat("\t{{{0}}},\n", nParameter++); } } if (!hasFields) { throw new DataAccessException( string.Format("There are no fields to update in the type '{0}'.", query.ObjectType.FullName)); } sb.Remove(sb.Length - 2, 1); AddWherePK(db, query, sb, nParameter); query.QueryText = sb.ToString(); return(query); }
protected SqlQueryInfo CreateSelectByKeySqlText(DbManager db, Type type) { ObjectMapper om = db.MappingSchema.GetObjectMapper(type); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); sb.Append("SELECT\n"); foreach (MemberMapper mm in GetFieldList(om)) sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); sb.Remove(sb.Length - 2, 1); sb.AppendFormat("FROM\n\t{0}\n", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); AddWherePK(db, query, sb); query.QueryText = sb.ToString(); return query; }
protected SqlQueryInfo CreateUpdateSqlText(DbManager db, Type type) { TypeExtension typeExt = TypeExtension.GetTypeExtension(type, Extensions); ObjectMapper om = db.MappingSchema.GetObjectMapper(type); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); MetadataProviderBase mp = MappingSchema.MetadataProvider; sb.AppendFormat("UPDATE\n\t{0}\nSET\n", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); foreach (MemberMapper mm in GetFieldList(om)) { bool isSet; if (!mp.GetNonUpdatableFlag(type, typeExt, mm.MemberAccessor, out isSet) || !isSet) { SqlQueryParameterInfo p = query.AddParameter( db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0} = {1},\n", db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField), p.ParameterName); } } sb.Remove(sb.Length - 2, 1); AddWherePK(db, query, sb); query.QueryText = sb.ToString(); return query; }
protected SqlQueryInfo CreateInsertSqlText(DbManager db, Type type) { TypeExtension typeExt = TypeExtension.GetTypeExtension(type, Extensions); ObjectMapper om = db.MappingSchema.GetObjectMapper(type); List<MemberMapper> list = new List<MemberMapper>(); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); MetadataProviderBase mp = MappingSchema.MetadataProvider; sb.AppendFormat("INSERT INTO {0} (\n", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); foreach (MemberMapper mm in GetFieldList(om)) { // IT: This works incorrectly for complex mappers. // bool isSet; if (!mp.GetNonUpdatableFlag(type, typeExt, mm.ComplexMemberAccessor, out isSet) || !isSet) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); list.Add(mm); } } sb.Remove(sb.Length - 2, 1); sb.Append(") VALUES (\n"); foreach (MemberMapper mm in list) { SqlQueryParameterInfo p = query.AddParameter( db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0},\n", p.ParameterName); } sb.Remove(sb.Length - 2, 1); sb.Append(")"); query.QueryText = sb.ToString(); return query; }
protected virtual void AddWherePK(DbManager db, SqlQueryInfo query, StringBuilder sb, int nParameter) { sb.Append("WHERE\n"); var memberMappers = GetKeyFieldList(db, query.ObjectType); if (memberMappers.Length == 0) throw new DataAccessException( string.Format("No primary key field(s) in the type '{0}'.", query.ObjectType.FullName)); foreach (var mm in memberMappers) { var p = query.AddParameter( db.DataProvider.Convert(mm.Name + "_W", ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0} = ", db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField)); if (nParameter < 0) sb.AppendFormat("{0} AND\n", p.ParameterName); else sb.AppendFormat("{{{0}}} AND\n", nParameter++); } sb.Remove(sb.Length - 5, 5); }
protected SqlQueryInfo CreateDeleteSqlText(DbManager db, Type type) { ObjectMapper om = db.MappingSchema.GetObjectMapper(type); StringBuilder sb = new StringBuilder(); SqlQueryInfo query = new SqlQueryInfo(om); sb.AppendFormat("DELETE FROM\n\t{0}\n", db.DataProvider.Convert(GetTableName(type), ConvertType.NameToQueryTable)); AddWherePK(db, query, sb); query.QueryText = sb.ToString(); return query; }
protected void AddWherePK(DbManager db, SqlQueryInfo query, StringBuilder sb, int nParameter, FullObjectMapper mapper) { sb.Append("WHERE\n"); foreach (IMapper mm in mapper.PropertiesMapping) { if (mm is ValueMapper && mm.DataReaderIndex == mapper.DataReaderIndex) { var valueMapper = (ValueMapper) mm; string tableAlias = mapper.PropertyType.Name; //mm.Name = ID_TRACK SqlQueryParameterInfo p = query.AddParameter( db.DataProvider.Convert(valueMapper.ColumnName + "_W", ConvertType.NameToQueryParameter). ToString(), valueMapper.ColumnName); sb.AppendFormat("\t{0}.{1} = ", "T" /* tableAlias */, db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField)); if (nParameter < 0) sb.AppendFormat("{0} AND\n", p.ParameterName); else sb.AppendFormat("{{{0}}} AND\n", nParameter++); } } sb.Remove(sb.Length - 5, 5); }
protected SqlQueryInfo CreateSelectAllSqlText(DbManager db, Type type) { var om = db.MappingSchema.GetObjectMapper(type); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); sb.Append("SELECT\n"); foreach (var mm in GetFieldList(om)) sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); sb.Remove(sb.Length - 2, 1); sb.Append("FROM\n\t"); AppendTableName(sb, db, type); query.QueryText = sb.ToString(); return query; }
protected SqlQueryInfo CreateInsertSqlText(DbManager db, Type type, int nParameter, bool insertAutoSequence = false) { var typeExt = TypeExtension.GetTypeExtension(type, Extensions); var om = db.MappingSchema.GetObjectMapper(type); var list = new List<MemberMapper>(); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); var mp = MappingSchema.MetadataProvider; sb.Append("INSERT INTO "); AppendTableName(sb, db, type); sb.Append(" (\n"); foreach (var mm in GetFieldList(om)) { // IT: This works incorrectly for complex mappers. // // [2009-03-24] ili: use mm.MemberAccessor instead of mm.ComplexMemberAccessor // as in CreateUpdateSqlText // bool isSet; var nonUpdatableAttribute = mp.GetNonUpdatableAttribute(type, typeExt, mm.MapMemberInfo.MemberAccessor, out isSet); if (insertAutoSequence && nonUpdatableAttribute is IdentityAttribute) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); list.Add(mm); } else { if (nonUpdatableAttribute == null || !isSet || nonUpdatableAttribute.IsIdentity || nonUpdatableAttribute.OnInsert == false) { sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(mm.Name, ConvertType.NameToQueryField)); list.Add(mm); } } } sb.Remove(sb.Length - 2, 1); sb.Append(") VALUES (\n"); MemberMapper identityMember = null; foreach (var mm in list) { var keyGenerator = mm.MapMemberInfo.KeyGenerator as SequenceKeyGenerator; if (keyGenerator != null && insertAutoSequence) { string seqQuery = db.DataProvider.NextSequenceQuery(keyGenerator.Sequence); sb.AppendFormat("\t{0},\n", seqQuery); identityMember = mm; } else { // Previously : mm.Name var p = query.AddParameter( db.DataProvider.Convert(mm.MemberName + "_P", ConvertType.NameToQueryParameter).ToString(), mm.Name); if (nParameter < 0) sb.AppendFormat("\t{0},\n", p.ParameterName); //sb.AppendFormat("\t{0},\n", db.DataProvider.Convert(p.ParameterName, ConvertType.NameToQueryParameter)); else sb.AppendFormat("\t{{{0}}},\n", nParameter++); } } sb.Remove(sb.Length - 2, 1); sb.Append(")"); if (identityMember != null) { sb.AppendFormat("\r\n{0}", db.DataProvider.GetReturningInto(identityMember.Name)); query.AddParameter( db.DataProvider.Convert("IDENTITY_PARAMETER", ConvertType.NameToQueryParameter).ToString(), identityMember.Name); } query.QueryText = sb.ToString(); return query; }
protected SqlQueryInfo CreateDeleteSqlText(DbManager db, Type type, int nParameter) { var om = db.MappingSchema.GetObjectMapper(type); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); sb.Append("DELETE FROM\n\t"); AppendTableName(sb, db, type); sb.AppendLine(); AddWherePK(db, query, sb, nParameter); query.QueryText = sb.ToString(); return query; }
protected SqlQueryInfo CreateUpdateSqlText(DbManager db, Type type, int nParameter) { var typeExt = TypeExtension.GetTypeExtension(type, Extensions); var om = db.MappingSchema.GetObjectMapper(type); var sb = new StringBuilder(); var query = new SqlQueryInfo(om); var mp = MappingSchema.MetadataProvider; sb.Append("UPDATE\n\t"); AppendTableName(sb, db, type); sb.Append("\nSET\n"); var fields = GetFieldList(om); var hasFields = false; foreach (var mm in fields) { bool isSet; var nonUpdatableAttribute = mp.GetNonUpdatableAttribute(type, typeExt, mm.MapMemberInfo.MemberAccessor, out isSet); if (nonUpdatableAttribute != null && isSet && nonUpdatableAttribute.OnUpdate == true) continue; mp.GetPrimaryKeyOrder(type, typeExt, mm.MapMemberInfo.MemberAccessor, out isSet); if (isSet) continue; hasFields = true; var p = query.AddParameter( db.DataProvider.Convert(mm.Name + "_P", ConvertType.NameToQueryParameter).ToString(), mm.Name); sb.AppendFormat("\t{0} = ", db.DataProvider.Convert(p.FieldName, ConvertType.NameToQueryField)); if (nParameter < 0) sb.AppendFormat("{0},\n", p.ParameterName); else sb.AppendFormat("\t{{{0}}},\n", nParameter++); } if (!hasFields) throw new DataAccessException( string.Format("There are no fields to update in the type '{0}'.", query.ObjectType.FullName)); sb.Remove(sb.Length - 2, 1); AddWherePK(db, query, sb, nParameter); query.QueryText = sb.ToString(); return query; }