This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Now, if you are using MySql database in such a
scenario, replication via a master-slaves servers is a must for
scalability reasons. In essence, this means that we would need to use the slave
databases for reading data, and the master database for writing data. There are even trickier scenarios where the actual content in database tables are replicated over several MySql servers. Both such solutions must make it possible to actually pinpoint a specific database from the code. (as a comment: I don't particularly like this since I think the code should be database agnostic via a load balancer. But as I understood it, in MySql this is not possible due to the missing clustering feature in MySql.) However,
it does not seem to be possible to switch database context in between a
read and a write (e.g. within a single UnitOfWork ). I know the guys at this company had the exact same problem with
NHibernate some time ago, but I was hoping LightSpeed would make this possible. So, Is there a way to actually switch database between different repository actions (e.g. Find, CompleteUintOfWork etc) and still utilize the same domain model objects provided to the Repository? I know that this requires that the MySql data replication works extremely well, but as I understood it, this is one of the strongest features of MySql so it is supposedly not a problem.
|
|
|
My bad... This is very much possible and works great with Lightspeed. After the Repository.Find method has been used to extract the data, the Repository.CompleteUnitOfWork() has to be executed. Once this has been done it is possible to switch database with something like this:
However, since the object has been retrieved, it is possible to just attach it to the repository again using the Repository.Attach method. This will still mean that the UoW will work and only the changed data is going to be saved to the database. Great! |
|