public AccountRepository() { //初始化属性 this._forumAccounts = new HashSet <Account>(); this._newAccounts = new HashSet <Account>(); this._removedAccounts = new HashSet <Account>(); this._modifiedAccounts = new HashSet <Account>(); //加载数据 this._forumAccounts = AccountPersist.GetAllAccounts(); }
/// <summary> /// 持久化所有 /// </summary> public void PersistAll() { DataTable newAccountTable = new DataTable("newAccountTable"); foreach (Account a in this._newAccounts) { a.AlterToRow(newAccountTable); } AccountPersist.PersistAll(newAccountTable); this._newAccounts.Clear(); //其它更改提交 }