Loading an object from a db4o database -


I am developing an e-commerce website which uses DB4O as backend. Everything was just fine last week when I had a problem that I could not solve. The codes below are quite straightforward. I open a database file, save the object and then try to retrieve it. Although I did not get anything back, the "user" variable is counting zero.

  Public class program {Private Static String _ Connection String = String Format (@ "C: \ AARRRD DB4O"); Fixed zero main (string [] args) {TestUser container = new test user () {id = 1, name = "mohammad", alias = "rafiq"}; Db4oFactory.Configure (). Diagnostic (). AddListener (New DiagnosticsToken ()); (Using var dbc = db4oFactory.OpenFile (_connectionString)) {dbc.Store (container); } IiLIT & lt; Testusor & gt; User = null; (Var dbc = db4oFactory.OpenFile (_connectionString)) using {user = dbc.Query & lt; TestUser & gt; (X => x.id == 1) .toList (); } If (users.Count> 0) {Console.WriteLine ("{0} {id} with ID {2}", users.First () .names, users.First (). ) .id); } Else {Console.WriteLine ("\ nNo data."); } Console. Readline (); }} Public Class Test User {{Indexed} Private Entidit_id = 0; Private string _name = string.Empty; Private string _surname = string.Empty; Public Entry ID {return {return_id; } Set {_id = value; }} Public string name {get {return _name; } Set {_name = value; }} Public string alias {get {return_surname; } Set {_surname = value; }}}  

I have attached the db4o diagnostic listener and I do not see anything in the console output. Everything looks fine, I know I am writing files because I can see an increase in file size and timestamps are updated too. I have checked all the project settings and they are all set to default I am using Net4, Visual Studio 2010 Beta and Windows 7. I have read something about the permission of the image but I can not see how it applies. Any help or ideas will be badly appreciated.

After calling the store (), you have to commit () before using {} statement You have closed your database before making your change.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -