You have a few possibilities: 1) If you are not using lazy loading, a WinForms application works well without SessionScopes. This opens a session per operation with instant refreshes per read.
2) If you are using large amounts of data, you will need lazy loading and session scopes. In this case, you should use a SessionScope per form. 3) You can use TransactionScopes within the operations that update the data. Upon leaving the transaction scope, session and transaction are flushed to the database, allowing other to see the changes. Loading a few records may be much work for AR, though. If you are not using lazy loading, all related objects are loaded and the objects related to those etc. You may well be loading the whole database by calling a simple Entity.FindAll(); without knowing it. You can check this by using NH Prof (recommended) or SQL Server Query Analyzer. -Markus 2009/5/26 vekaz turkovic <[email protected]>: > > Hi all, > > I am using Castle AR in a WinForms application. I made a quick switch > from Linq to Sql to AR near the end of a project, and didn't have the > time to properly learn AR/NHibernate before I started using it. > So, be gentle, this may be a really stupid question... > > Several users run the application simultaneously. I want to reload the > data from the database each time a user saves something. I am getting > the data using the same code when a form is first > loaded, and later, after data is saved. This seemed to work ok, until I > tested the app with two users using the app simultaneously. First user > saves stuff, second user tries to reload the data, > but he doesn't see the changes made by the first user until the app is > restarted. > > If i dispose the current scope and create a new one, everything works > perfectly, but it takes forever to complete. If I run the application on > my desktop computer, the same computer where the SQL Server is, > everything is fine. But, when I run it on my laptop, and connect to the > server through the network, the process of saving, disposing the current > scope, creating a new one and reloading the data (which is usually just > several records) takes about 10 seconds. > > Is there any other way of forcing AR to get the data from the DB, not > the cache? Or, am i doing all this completely wrong? > > I need to find solution to this asap, any suggestions are very welcome. > > Thanks in advance. > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
