Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1758 for trunk


Ignore:
Timestamp:
05/08/09 12:42:03 (15 years ago)
Author:
svonolfe
Message:

Small refactoring of the manyToManyRelationHelper (#527)

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/ManyToManyRelationHelper.cs

    r1729 r1758  
    1010    {
    1111    ITableAdapterWrapper<AdapterT, ManyToManyRelation, RowT> tableAdapterWrapper;
    12    
     12
     13    private int childIndex;
     14
    1315    public ManyToManyRelationHelper(
    14       ITableAdapterWrapper<AdapterT, ManyToManyRelation, RowT> tableAdapterWrapper) {
     16      ITableAdapterWrapper<AdapterT, ManyToManyRelation, RowT> tableAdapterWrapper,
     17      int childIndex) {
    1518      this.tableAdapterWrapper = tableAdapterWrapper;
     19      this.childIndex = childIndex;
    1620    }
    1721
     
    2428    public void UpdateRelationships(Guid objectA,
    2529      IList<Guid> relationships, int childIndex) {
    26       UpdateRelationships(objectA, relationships, null, childIndex);
     30      UpdateRelationships(objectA, relationships, null);
    2731    }
    2832
    2933    public void UpdateRelationships(Guid objectA,
    3034      IList<Guid> relationships,
    31       IList<object> additionalAttributes, int childIndex) {
     35      IList<object> additionalAttributes) {
    3236      //firstly check for created references
    3337      IList<Guid> existing =
    34         this.GetRelationships(objectA, childIndex);
     38        this.GetRelationships(objectA);
    3539
    3640      foreach (Guid relationship in relationships) {
     
    6367      foreach (Guid relationship in deleted) {
    6468        RowT toDelete =
    65           FindRow(objectA, relationship, childIndex);
     69          FindRow(objectA, relationship);
    6670        if (toDelete != null) {
    6771          toDelete.Delete();
     
    7175    }
    7276
    73     public IList<Guid> GetRelationships(Guid objectA, int childIndex) {
     77    public IList<Guid> GetRelationships(Guid objectA) {
    7478      IList<Guid> result =
    7579        new List<Guid>();
     
    8589    }
    8690
    87     private RowT FindRow(Guid objectA, Guid objectB, int childIndex) {
     91    private RowT FindRow(Guid objectA, Guid objectB) {
    8892      IEnumerable<RowT> rows =
    8993       tableAdapterWrapper.FindById(objectA);
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs

    r1756 r1758  
    5151          manyToManyRelationHelper =
    5252            new ManyToManyRelationHelper<dsHiveServerTableAdapters.ClientGroup_ResourceTableAdapter,
    53               dsHiveServer.ClientGroup_ResourceRow>(new ClientGroup_ResourceAdapterWrapper());
     53              dsHiveServer.ClientGroup_ResourceRow>(new ClientGroup_ResourceAdapterWrapper(), 1);
    5454        }
    5555
     
    8686
    8787        ICollection<Guid> resources =
    88           ManyToManyRelationHelper.GetRelationships(clientGroup.Id, 1);
     88          ManyToManyRelationHelper.GetRelationships(clientGroup.Id);
    8989
    9090        clientGroup.Resources.Clear();
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs

    r1729 r1758  
    5151          manyToManyRelationHelper =
    5252            new ManyToManyRelationHelper<dsHiveServerTableAdapters.RequiredPluginsTableAdapter,
    53               dsHiveServer.RequiredPluginsRow>(new RequiredPluginsAdapterWrapper());
     53              dsHiveServer.RequiredPluginsRow>(new RequiredPluginsAdapterWrapper(), 1);
    5454        }
    5555
     
    164164
    165165        ICollection<Guid> requiredPlugins =
    166           ManyToManyRelationHelper.GetRelationships(job.Id, 1);
     166          ManyToManyRelationHelper.GetRelationships(job.Id);
    167167       
    168168        job.PluginsNeeded.Clear();
  • trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/UserGroupAdapter.cs

    r1729 r1758  
    2828          manyToManyRelationHelper =
    2929            new ManyToManyRelationHelper<dsSecurityTableAdapters.PermissionOwner_UserGroupTableAdapter,
    30               dsSecurity.PermissionOwner_UserGroupRow>(new PermissionOwner_UserGroupAdapterWrapper());
     30              dsSecurity.PermissionOwner_UserGroupRow>(new PermissionOwner_UserGroupAdapterWrapper(), 0);
    3131        }
    3232
     
    6767
    6868        ICollection<Guid> permissionOwners =
    69           ManyToManyRelationHelper.GetRelationships(group.Id, 0);
     69          ManyToManyRelationHelper.GetRelationships(group.Id);
    7070
    7171        group.Members.Clear();
Note: See TracChangeset for help on using the changeset viewer.