我有9个xml文件,这是我们的项目数据库,我们用这个方法写入数据库 我只给了一点代码。
public int WriteDatabase(string path)
{
lock(m_spoData)
{
m_spoData.DataVersion.Rows.Clear();
SpoConfigData ds = new SpoConfigData();
ds.ExternalApplication.Merge( m_spoData.ExternalApplication );
ds.WriteXml( path + ExtAppFile );
ds.Clear();
ds.SpoServer.Merge(m_spoData.SpoServer);
ds.ManagedObject.Merge( m_spoData.ManagedObject );
ds.AttributeValue.Merge( m_spoData.AttributeValue );
ds.Threshold.Merge( m_spoData.Threshold );
ds.WriteXml( path + ObjectFile );
ds.Clear();
ds.ObjectClass.Merge( m_spoData.ObjectClass );
ds.ObjectAttribute.Merge( m_spoData.ObjectAttribute );
ds.WriteXml( path + ClassFile );
ds.Clear();
ds.Image.Merge( m_spoData.Image );
ds.AlertImageList.Merge( m_spoData.AlertImageList );
ds.WriteXml( path + ImageFile );
ds.Clear();
ds.ManagedGroup.Merge( m_spoData.ManagedGroup );
ds.WriteXml( path + GroupFile );
ds.Clear();
ds.UserZone.Merge( m_spoData.UserZone );
ds.ViewFolder.Merge( m_spoData.ViewFolder );
ds.ViewGroup.Merge( m_spoData.ViewGroup );
ds.ZoneMgGrpCollection.Merge( m_spoData.ZoneMgGrpCollection );
ds.WriteXml( path + ZoneFile );
ds.Clear();
ds.ResourcePolicy.Merge( m_spoData.ResourcePolicy );
ds.ResourceType.Merge( m_spoData.ResourceType );
ds.ResourceObject.Merge( m_spoData.ResourceObject );
ds.ResourceAttrValue.Merge( m_spoData.ResourceAttrValue );
ds.WriteXml( path + ResourcePolicyFile );
ds.Clear();
ds.Principal.Merge(m_spoData.Principal);
ds.Role.Merge( m_spoData.Role );
ds.WriteXml( path + RoleFile );
ds.Clear();
ds.Permission.Merge( m_spoData.Permission );
ds.WriteXml( path + PermissionFile );
ds.Clear();} }
她的下方有两行代码就像这样
// reset data version base on file last write time.
m_spoData.DataVersion.AddDataVersionRow( ( new FileInfo( path + ZoneFile ) ).LastWriteTime.Ticks );
如果我将ZoneFile更改为PermissionFile会对此产生什么影响
答案 0 :(得分:1)
看起来代码正在使用LastWriteTime.Ticks
- 这是一个表示文件上次写入时间的数值 - 作为某种版本控制机制。由于你在同一时间写两个文件(PermissionFile和ZoneFile),我不希望有任何重大差异。