Inheritance: OptimizedPersistable
示例#1
0
    static readonly string systemDir = "QuickStart"; // appended to SessionBase.BaseDatabasePath

    static int Main(string[] args)
    {
      using (SessionNoServer session = new SessionNoServer(systemDir))
      {
        Console.WriteLine("Running with databases in directory: " + session.SystemDirectory);
        try
        {
          session.BeginUpdate();
          Company company = new Company();
          company.Name = "MyCompany";
          session.Persist(company);
          Employee employee1 = new Employee();
          employee1.Employer = company;
          employee1.FirstName = "John";
          employee1.LastName = "Walter";
          session.Persist(employee1);
          session.Commit();
        }
        catch (Exception ex)
        {
          Trace.WriteLine(ex.Message);
          session.Abort();
        }
      }
      Retrieve();
      return 0;
    }
示例#2
0
    static readonly string systemDir = "QuickStart"; // appended to SessionBase.BaseDatabasePath

    static int Main(string[] args)
    {
      SessionNoServer session = new SessionNoServer(systemDir);
      Console.WriteLine("Running with databases in directory: " + session.SystemDirectory);
      session.BeginUpdate();
      Company company = new Company();
      company.Name = "MyCompany";
      session.Persist(company);

      Employee employee1 = new Employee();
      employee1.Employer = company;
      employee1.FirstName = "John";
      employee1.LastName = "Walter";
      session.Persist(employee1);
      session.Commit();
      Retrieve();
      return 0;
    }