switch to sqlite

This commit is contained in:
2022-03-11 16:10:11 +08:00
parent f5f16d43f4
commit 5ec4119025
25 changed files with 286 additions and 435 deletions

View File

@@ -1,10 +1,11 @@
using System;
using System.Xml.Linq;
using SQLite;
namespace Billing.Models
{
public class Bill : BaseModel
public class Bill : IIdItem
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public decimal Amount { get; set; }
public string Name { get; set; }
@@ -13,29 +14,5 @@ namespace Billing.Models
public string Store { get; set; }
public DateTime CreateTime { get; set; }
public string Note { get; set; }
public override void OnXmlDeserialize(XElement node)
{
Id = Read(node, nameof(Id), 0);
Amount = Read(node, nameof(Amount), 0m);
Name = Read(node, nameof(Name), string.Empty);
CategoryId = Read(node, nameof(CategoryId), -1);
WalletId = Read(node, nameof(WalletId), -1);
Store = Read(node, nameof(Store), string.Empty);
CreateTime = Read(node, nameof(CreateTime), default(DateTime));
Note = Read(node, nameof(Note), string.Empty);
}
public override void OnXmlSerialize(XElement node)
{
Write(node, nameof(Id), Id);
Write(node, nameof(Amount), Amount);
Write(node, nameof(Name), Name);
Write(node, nameof(CategoryId), CategoryId);
Write(node, nameof(WalletId), WalletId);
Write(node, nameof(Store), Store);
Write(node, nameof(CreateTime), CreateTime);
Write(node, nameof(Note), Note);
}
}
}