I'm working on an application that has a data publication mecanism that I designed & implemented. It allows one master instance of the app to feed data to many subscriber instances. This is implemented by loading the master's data into a set of temporary import tables that have the same exact schema on the subscriber. The merge process uses these import tables to do its work.
我正在开发一个具有我设计和实现的数据发布机制的应用程序。它允许应用程序的一个主实例将数据提供给许多订阅者实例。这是通过将主数据加载到一组临时导入表中来实现的,这些临时导入表在订阅者上具有相同的确切模式。合并过程使用这些导入表来完成其工作。
This whole publication thing is working fine. It is performed outside of NHibernate using ADO.NET for batch loading, sets of stored procedures for diff'ing & merging (they're autogenerated by a custom tool). Also, we only have an HTTP link available between master/subscriber to download the data; we can't connect directly to the master SQL server.
整个出版物的工作正常。它在NHibernate外部使用ADO.NET进行批量加载,用于差异和合并的存储过程集(它们由自定义工具自动生成)。此外,我们只有主/用户之间可用的HTTP链接来下载数据;我们无法直接连接到主SQL服务器。
The problem I face is visually showing the diff to the user before they actually merge the new data. In the application, I'd like to have NHibernate load our business object directly from these temporary import tables. Can we do this ? Without having to maintain two sets of almost identical mapping files ?
我面临的问题是在用户实际合并新数据之前直观地显示用户的差异。在应用程序中,我想让NHibernate直接从这些临时导入表加载我们的业务对象。我们可以这样做吗?无需维护两组几乎相同的映射文件?
In our last version, we were building up business objects using custom code that would load from these import tables. It would only load simple properties, not handling relations. This sucks big time from a coding/maintenance point of view.
在我们的上一个版本中,我们使用从这些导入表加载的自定义代码构建业务对象。它只会加载简单的属性,而不是处理关系。从编码/维护的角度来看,这会耗费大量时间。
1 个解决方案
#1
Are you trying to do something like this where you need to dynamically change the table names?
您是否尝试在需要动态更改表名的地方执行此类操作?
You may also want to look at Fluent NHibernate for a solution.
您可能还想查看Fluent NHibernate的解决方案。
Another possibility would be to have the temporary tables in a separate database and just change the connection string.
另一种可能性是将临时表放在单独的数据库中,只需更改连接字符串即可。
#1
Are you trying to do something like this where you need to dynamically change the table names?
您是否尝试在需要动态更改表名的地方执行此类操作?
You may also want to look at Fluent NHibernate for a solution.
您可能还想查看Fluent NHibernate的解决方案。
Another possibility would be to have the temporary tables in a separate database and just change the connection string.
另一种可能性是将临时表放在单独的数据库中,只需更改连接字符串即可。