check issue #15

This commit is contained in:
yubaolee 2016-09-10 18:48:28 +08:00
parent e430b2716d
commit 56a0581fe0

View File

@ -1,6 +1,7 @@
using OpenAuth.Domain; using OpenAuth.Domain;
using OpenAuth.Domain.Interface; using OpenAuth.Domain.Interface;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace OpenAuth.Repository namespace OpenAuth.Repository
@ -35,20 +36,16 @@ namespace OpenAuth.Repository
/// <param name="idMaps">关联的&lt;firstId, secondId&gt;数组</param> /// <param name="idMaps">关联的&lt;firstId, secondId&gt;数组</param>
public void AddRelevance(string key, ILookup<Guid, Guid> idMaps) public void AddRelevance(string key, ILookup<Guid, Guid> idMaps)
{ {
foreach (var sameVals in idMaps) DeleteBy(key, idMaps);
{ BatchAdd((from sameVals in idMaps
foreach (var value in sameVals) from value in sameVals
{ select new Relevance
Add(new Relevance
{ {
Key = key, Key = key,
FirstId = sameVals.Key, FirstId = sameVals.Key,
SecondId = value, SecondId = value,
OperateTime = DateTime.Now OperateTime = DateTime.Now
}); }).ToArray());
}
}
Save();
} }
} }
} }