Free cookie consent management tool by TermsFeed Policy Generator

Changeset 976 for trunk


Ignore:
Timestamp:
12/11/08 17:20:03 (16 years ago)
Author:
svonolfe
Message:

Fixed selecting by name (#372)

Location:
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs

    r972 r976  
    116116
    117117    public PermissionOwner GetPermissionOwnerByName(String name) {
    118       PermissionOwner permOwner = new PermissionOwner();
     118       dsHiveServer.PermissionOwnerRow row = null;
    119119
    120       dsHiveServer.PermissionOwnerRow row =
    121         data.Single<dsHiveServer.PermissionOwnerRow>(
    122           r => !r.IsNameNull() && r.Name == name);
     120      IEnumerable<dsHiveServer.PermissionOwnerRow> permOwners =
     121        from r in
     122          data.AsEnumerable<dsHiveServer.PermissionOwnerRow>()
     123        where !r.IsNameNull() && r.Name == name
     124        select r;
     125
     126      if (permOwners.Count<dsHiveServer.PermissionOwnerRow>() == 1)
     127        row = permOwners.First<dsHiveServer.PermissionOwnerRow>();
    123128
    124129      if (row != null) {
     130        PermissionOwner permOwner = new PermissionOwner();
    125131        Convert(row, permOwner);
    126132
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ResourceAdapter.cs

    r972 r976  
    113113
    114114    public Resource GetResourceByName(string name) {
    115       Resource resource = new Resource();
     115      dsHiveServer.ResourceRow row = null;
    116116
    117       dsHiveServer.ResourceRow row =
    118         data.Single<dsHiveServer.ResourceRow>(
    119           r => !r.IsNameNull() && r.Name == name);
     117      IEnumerable<dsHiveServer.ResourceRow> permOwners =
     118        from r in
     119          data.AsEnumerable<dsHiveServer.ResourceRow>()
     120        where !r.IsNameNull() && r.Name == name
     121        select r;
     122
     123      if (permOwners.Count<dsHiveServer.ResourceRow>() == 1)
     124        row = permOwners.First<dsHiveServer.ResourceRow>();
    120125
    121126      if (row != null) {
    122         Convert(row, resource);
     127        Resource res = new Resource();
     128        Convert(row, res);
    123129
    124         return resource;
     130        return res;
    125131      } else {
    126132        return null;
Note: See TracChangeset for help on using the changeset viewer.