Dan (DevExpress)
11.18.2008
1 Solution
Hello,
I have created a demo application, which demonstrates how to map a solid classes schema onto several databases (or, vice versa, how to create a solid classes schema over several databases).
In my application, I introduced a new IDataStore implementation, which works as a "Proxy" object: it receives all the requests from the application's Session objects to a data store, and redirects them to actual XPO data store objects based upon a table name that has been passed.
I should mention that this scenario is not a target scenario for XAF and XPO. We have not tested it with our internal applications, and it's possible that you will encounter difficulties even with typical XAF/XPO scenarios.
One of the limitations is that an object stored in one database cannot refer to an object stored in another database via a persistent property. Besides the fact that a criteria operator based on such a reference property cannot be evaluated, referenced objects are automatically loaded by XPO without involving the IDataStore.SelectData method. So, these queries cannot be redirected. As a workaround, you can implement a non-persistent reference property and use the Session.GetObjectByKey method to load a referenced object. Another possible solution is to use a delayed property.
See also:
- E1150
- Q97709
- Q136253
Thanks,
Dan.
-
eXpandFramework has a similar implementation. To use it you need to use XpandObjectSpaceProvider. The implementation involves many classes so it is hard to decouple it from the framework. However if it does not hurt you add a few references to Xpand.ExpressApp, Xpand.Xpo, Xpand.Utils and use XpandObjectSpaceProvider to enable the functionality. Here a few related posts
http://goo.gl/rHnQb
http://goo.gl/8el8k -
Hey Tolis,
Is it possible to manipulate data from one DataStore into another DataStore? Say Users in one database and whatever other objects in another DataStore that need some properties or reference the Users?Carlos
-
Hi Carlitos,
Although everything is possible with such rich API, I am afraid the current implementation does not support it by default. If you or anyone puts some time on this please share it with the rest of us.
Facebook
Twitter
Google+