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 { private IEnumerable<int> mentionedUsersIds {
get { get {
return from mention in Mention.LoadByIds( return from stringId in Config.instance.mainConnection.LoadIdsByConditions(
from stringId in Config.instance.mainConnection.LoadIdsByConditions(
Mention.TableSpec.instance, Mention.TableSpec.instance,
new ComparisonCondition( new ComparisonCondition(
Mention.TableSpec.instance.getColumnSpec(Mention.TableSpec.FIELD_POSTID), Mention.TableSpec.instance.getColumnSpec(Mention.TableSpec.FIELD_POSTID),
ComparisonType.EQUAL, ComparisonType.EQUAL,
this.id.ToString() this.id.ToString()
), ),
Diapasone.unlimited Diapasone.unlimited,
) select int.Parse(stringId) Mention.TableSpec.instance.getColumnSpec(Mention.TableSpec.FIELD_MENTIONEDUSERID)
) select mention.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) }); 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) { public static Transaction beginTransaction(this IDBConnection connection) {
return connection.beginTransaction(System.Data.IsolationLevel.ReadCommitted); return connection.beginTransaction(System.Data.IsolationLevel.ReadCommitted);
} }

Loading…
Cancel
Save