IComplexSqlObjectTableSpec implemented

main
Inga 🏳‍🌈 14 years ago
parent c8c1d8abf3
commit 4f21cc9cc5
  1. 2
      Builder/IISMainHandler/build.txt
  2. 1
      Common/Common.csproj
  3. 12
      Common/IComplexSqlObjectTableSpec.cs
  4. 6
      Common/dataobjects/Board.cs
  5. 6
      Common/dataobjects/Category.cs
  6. 8
      IISMainHandler/handlers/request/maintenance/CleanCacheHandler.cs

@ -103,6 +103,7 @@
<Compile Include="dataobjects\User.cs" /> <Compile Include="dataobjects\User.cs" />
<Compile Include="dataobjects\AccountSettings.cs" /> <Compile Include="dataobjects\AccountSettings.cs" />
<Compile Include="dataobjects\UserGroup.cs" /> <Compile Include="dataobjects\UserGroup.cs" />
<Compile Include="IComplexSqlObjectTableSpec.cs" />
<Compile Include="IOutputParams.cs" /> <Compile Include="IOutputParams.cs" />
<Compile Include="ISqlObjectTableSpec.cs" /> <Compile Include="ISqlObjectTableSpec.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FLocal.Common {
public interface IComplexSqlObjectTableSpec : ISqlObjectTableSpec {
void refreshSqlObjectAndRelated(int id);
}
}

@ -11,7 +11,7 @@ using FLocal.Common.actions;
namespace FLocal.Common.dataobjects { namespace FLocal.Common.dataobjects {
public class Board : SqlObject<Board> { public class Board : SqlObject<Board> {
public class TableSpec : ISqlObjectTableSpec { public class TableSpec : IComplexSqlObjectTableSpec {
public const string TABLE = "Boards"; public const string TABLE = "Boards";
public const string FIELD_ID = "Id"; public const string FIELD_ID = "Id";
public const string FIELD_SORTORDER = "SortOrder"; public const string FIELD_SORTORDER = "SortOrder";
@ -27,6 +27,10 @@ namespace FLocal.Common.dataobjects {
public string name { get { return TABLE; } } public string name { get { return TABLE; } }
public string idName { get { return FIELD_ID; } } public string idName { get { return FIELD_ID; } }
public void refreshSqlObject(int id) { Refresh(id); } public void refreshSqlObject(int id) { Refresh(id); }
public void refreshSqlObjectAndRelated(int id) {
Refresh(id);
LoadById(id).subBoards_Reset();
}
} }
public class ReadMarkerTableSpec : ISqlObjectTableSpec { public class ReadMarkerTableSpec : ISqlObjectTableSpec {

@ -9,7 +9,7 @@ using System.Xml.Linq;
namespace FLocal.Common.dataobjects { namespace FLocal.Common.dataobjects {
public class Category : SqlObject<Category> { public class Category : SqlObject<Category> {
public class TableSpec : ISqlObjectTableSpec { public class TableSpec : IComplexSqlObjectTableSpec {
public const string TABLE = "Categories"; public const string TABLE = "Categories";
public const string FIELD_ID = "Id"; public const string FIELD_ID = "Id";
public const string FIELD_SORTORDER = "SortOrder"; public const string FIELD_SORTORDER = "SortOrder";
@ -19,6 +19,10 @@ namespace FLocal.Common.dataobjects {
public string name { get { return TABLE; } } public string name { get { return TABLE; } }
public string idName { get { return FIELD_ID; } } public string idName { get { return FIELD_ID; } }
public void refreshSqlObject(int id) { Refresh(id); } public void refreshSqlObject(int id) { Refresh(id); }
public void refreshSqlObjectAndRelated(int id) {
Refresh(id);
LoadById(id).subBoards_Reset();
}
} }
protected override ISqlObjectTableSpec table { get { return TableSpec.instance; } } protected override ISqlObjectTableSpec table { get { return TableSpec.instance; } }

@ -23,9 +23,13 @@ namespace FLocal.IISHandler.handlers.request.maintenance {
int start = int.Parse(context.httprequest.Form["start"]); int start = int.Parse(context.httprequest.Form["start"]);
int length = int.Parse(context.httprequest.Form["length"]); int length = int.Parse(context.httprequest.Form["length"]);
ISqlObjectTableSpec tableSpec = TableManager.TABLES[table]; ISqlObjectTableSpec tableSpec = TableManager.TABLES[table];
for(int i=0; i<length; i++) { foreach(int id in Enumerable.Range(start, length)) {
try { try {
tableSpec.refreshSqlObject(start+i); if(tableSpec is IComplexSqlObjectTableSpec) {
((IComplexSqlObjectTableSpec)tableSpec).refreshSqlObjectAndRelated(id);
} else {
tableSpec.refreshSqlObject(id);
}
} catch(NotFoundInDBException) { } catch(NotFoundInDBException) {
} }
} }

Loading…
Cancel
Save