/// <summary> /// 保存多条数据 /// </summary> public void SaveDatas <T>(Dictionary <T, object> dataMap) where T : class { Type type = typeof(T); string tableName = type.Name; string keyName = _keyMap[type]; IBox box = _autoBox.Cube(); Binder binder = box.Bind(tableName); foreach (KeyValuePair <T, object> kv in dataMap) { T dbObj = kv.Key; object keyValue = kv.Value; if (_autoBox.SelectCount(string.Format("from {0} where {1} == ?", tableName, keyName), keyValue) <= 0) { binder.Insert(dbObj); } else { binder.Update(dbObj); } } box.Commit(); box.Dispose(); }