Before update to NET 7

This commit is contained in:
CortexCore
2023-07-12 12:11:10 +08:00
parent ca824c3b32
commit 4af7cec47b
15 changed files with 480 additions and 214 deletions

View File

@@ -179,7 +179,7 @@ public class IDIS_DBContext:DbContext
Handle = handle
};
Values.Add(value);
SaveChanges();
SaveChangesAsync();
return true;
}
public void Register(string handle,string format, string value,string category)
@@ -197,7 +197,7 @@ public class IDIS_DBContext:DbContext
Category = category,
};
Datas.Add(data);
SaveChanges();
SaveChangesAsync();
}
public void RegisterReference(string handle, string refenceHandle)
@@ -207,19 +207,17 @@ public class IDIS_DBContext:DbContext
Handle = handle,
RelatedHandle = refenceHandle,
});
SaveChanges();
SaveChangesAsync();
}
public bool Update(string handle, string format, string value)
{
var result = Datas.FirstOrDefault(x => x.Handle == handle && x.Format == format);
if (result is not null)
{
result.UpdateTime=DateTime.Now;
result.Value = value;
SaveChanges();
}
return result is not null;
if (result is null) return false;
result.UpdateTime=DateTime.Now;
result.Value = value;
SaveChangesAsync();
return true;
}
}
// ReSharper disable once IdentifierTypo