diff --git a/Common/SqlObject.cs b/Common/SqlObject.cs index cbf2746..6db7fde 100644 --- a/Common/SqlObject.cs +++ b/Common/SqlObject.cs @@ -69,6 +69,14 @@ namespace FLocal.Common { } } + protected void LoadFromHashIfNotLoaded(Dictionary data) { + lock(this.lockInitializer) { + if(this.isLoaded) return; + this.fromHash(data); + this.isLoaded = true; + } + } + protected void LoadIfNotLoaded() { if(!this.isLoaded) { lock(this.lockInitializer) { @@ -120,7 +128,7 @@ namespace FLocal.Common { int id = int.Parse(row[table.idName]); loadedIds.Add(id); if(!rawRes.ContainsKey(id)) throw new CriticalException("wrong id"); - rawRes[id].LoadFromHash(row); + rawRes[id].LoadFromHashIfNotLoaded(row); } }