This commit is contained in:
@@ -415,9 +415,7 @@ namespace AyaNova.Biz
|
|||||||
List<MatchingDictionaryEntry> MatchingKeywordIdList = new List<MatchingDictionaryEntry>();
|
List<MatchingDictionaryEntry> MatchingKeywordIdList = new List<MatchingDictionaryEntry>();
|
||||||
|
|
||||||
|
|
||||||
//######### FROM HERE NEEDS TO LOCK SEARCHDICTIONARY FROM HERE TO ADDING NEW WORDS
|
|
||||||
using (var transaction = ct.Database.BeginTransaction())
|
|
||||||
{
|
|
||||||
//ITERATE ALL THE KEYWORDS, SEARCH IN THE SEARCHDICTIONARY TABLE AND COLLECT ID'S OF ANY PRE-EXISTING IN DB KEYWORDS
|
//ITERATE ALL THE KEYWORDS, SEARCH IN THE SEARCHDICTIONARY TABLE AND COLLECT ID'S OF ANY PRE-EXISTING IN DB KEYWORDS
|
||||||
var ExistingKeywordMatches = ct.SearchDictionary.Where(m => KeyWordList.Contains(m.Word)).ToDictionary(m => m.Id, m => m.Word);
|
var ExistingKeywordMatches = ct.SearchDictionary.Where(m => KeyWordList.Contains(m.Word)).ToDictionary(m => m.Id, m => m.Word);
|
||||||
//Put the matching keyword ID's into the list
|
//Put the matching keyword ID's into the list
|
||||||
@@ -446,12 +444,21 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
//adding in a range sped this up noticeably
|
//adding in a range sped this up noticeably
|
||||||
ct.SearchDictionary.AddRange(NewSearchDictionaryWordsList);
|
ct.SearchDictionary.AddRange(NewSearchDictionaryWordsList);
|
||||||
|
try
|
||||||
|
{
|
||||||
ct.SaveChanges();
|
ct.SaveChanges();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
transaction.Commit();
|
{
|
||||||
}//end transaction
|
//In integration testing hit duplicate values of widget names
|
||||||
//#########################
|
//adjusted uniquify code in test util class to use milliseconds instead of seconds (duh) and didn't hit this again,
|
||||||
|
//however just in case I'm leaving it here as a potential debug break point if it arises again
|
||||||
|
//Outside of a test situation I can't imagine this will be an issue in actual production use
|
||||||
|
//as it seems unlikely that two separate manual users inputting data are going to generate the same word at the same exact moment
|
||||||
|
//in time
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace raven_integration
|
|||||||
uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||||
|
|
||||||
//Now TechFullAuthToken attempt to modify it via patch
|
//Now TechFullAuthToken attempt to modify it via patch
|
||||||
var newName = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToPatchNonOwned - UPDATED TEST WIDGET");
|
var newName = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToPatchNonOwned - UPDATED TEST WIDGETB");
|
||||||
string patchJson = "[{\"value\": \"" + newName + "\",\"path\": \"/name\",\"op\": \"replace\"}]";
|
string patchJson = "[{\"value\": \"" + newName + "\",\"path\": \"/name\",\"op\": \"replace\"}]";
|
||||||
a = await Util.PatchAsync("Widget/" + Id.ToString() + "/" + OriginalConcurrencyToken.ToString(), await Util.GetTokenAsync( "TechFull"), patchJson);
|
a = await Util.PatchAsync("Widget/" + Id.ToString() + "/" + OriginalConcurrencyToken.ToString(), await Util.GetTokenAsync( "TechFull"), patchJson);
|
||||||
//2004 unauthorized expected
|
//2004 unauthorized expected
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace raven_integration
|
|||||||
public static string Uniquify(string s)
|
public static string Uniquify(string s)
|
||||||
{
|
{
|
||||||
|
|
||||||
return s + ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
|
return s + ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds().ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async static Task<string> GetTokenAsync(string login, string password = null)
|
public async static Task<string> GetTokenAsync(string login, string password = null)
|
||||||
|
|||||||
Reference in New Issue
Block a user