Post.mentionedUsersIds optimized

main
Inga 🏳‍🌈 13 years ago
parent fc80b3d8e4
commit 88fa0e7758
  1. 9
      FLocal.Common/dataobjects/Post.cs
  2. 4
      Web.Core/DB/IDBConnection.cs

@ -391,17 +391,16 @@ namespace FLocal.Common.dataobjects {
private IEnumerable<int> mentionedUsersIds {
get {
return from mention in Mention.LoadByIds(
from stringId in Config.instance.mainConnection.LoadIdsByConditions(
return from stringId in Config.instance.mainConnection.LoadIdsByConditions(
Mention.TableSpec.instance,
new ComparisonCondition(
Mention.TableSpec.instance.getColumnSpec(Mention.TableSpec.FIELD_POSTID),
ComparisonType.EQUAL,
this.id.ToString()
),
Diapasone.unlimited
) select int.Parse(stringId)
) select mention.mentionedUserId;
Diapasone.unlimited,
Mention.TableSpec.instance.getColumnSpec(Mention.TableSpec.FIELD_MENTIONEDUSERID)
) select int.Parse(stringId);
}
}

@ -41,6 +41,10 @@ namespace Web.Core.DB {
return connection.LoadIdsByConditions(table, conditions, diapasone, joins, new SortSpec[] { new SortSpec(table.getIdSpec(), true) });
}
public static List<string> LoadIdsByConditions(this IDBConnection connection, ITableSpec table, AbstractCondition conditions, Diapasone diapasone, ColumnSpec idSpec, params SortSpec[] sorts) {
return connection.LoadIdsByConditions(table, conditions, diapasone, new JoinSpec[0], sorts, idSpec, false);
}
public static Transaction beginTransaction(this IDBConnection connection) {
return connection.beginTransaction(System.Data.IsolationLevel.ReadCommitted);
}

Loading…
Cancel
Save