static readonly string systemDir = "Sample3"; // appended to SessionBase.BaseDatabasePath static void Main(string[] args) { try { using (SessionNoServer session = new SessionNoServer(systemDir)) { Console.WriteLine("Running with databases in directory: " + session.SystemDirectory); session.BeginUpdate(); Person robinHood = new Person("Robin", "Hood", 30); Person billGates = new Person("Bill", "Gates", 56, robinHood); Person steveJobs = new Person("Steve", "Jobs", 56, billGates); robinHood.BestFriend = billGates; session.Persist(steveJobs); steveJobs.Friends.Add(billGates); steveJobs.Friends.Add(robinHood); billGates.Friends.Add(billGates); robinHood.Friends.Add(steveJobs); session.Commit(); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
static void Main(string[] args) { SessionBase.DoWindowsAuthentication = false; // Make sure to use the same setting when starting VelocityDBServer, see http://www.velocitydb.com/UserGuide.aspx try { // initial DatabaseLocation directory and hostname using (ServerClientSession session = new ServerClientSession(systemDir, System.Net.Dns.GetHostName())) { session.BeginUpdate(); // your code here Person robinHood = new Person("Robin", "Hood", 30); Person billGates = new Person("Bill", "Gates", 56, robinHood); Person steveJobs = new Person("Steve", "Jobs", 56, billGates); robinHood.BestFriend = billGates; session.Persist(steveJobs); steveJobs.Friends.Add(billGates); steveJobs.Friends.Add(robinHood); billGates.Friends.Add(billGates); robinHood.Friends.Add(steveJobs); session.Commit(); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
#pragma warning restore 0169 public Person(string firstName, string lastName, UInt16 age, Person bestFriend = null) { this.firstName = firstName; this.lastName = lastName; this.age = age; this.bestFriend = bestFriend; friends = new List<Person>(); }
#pragma warning restore 0169 public Person(string firstName, string lastName, UInt16 age, Person bestFriend = null) { m_firstName = firstName; m_lastName = lastName; m_age = age; m_bestFriend = bestFriend; m_friends = new List<Person>(); }