/// <summary>
        /// Create, save and refresh projects
        /// </summary>
        /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
        public async Task SaveLoadAndRefreshProjectWithOneListAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            await(SaveProjectAsync(cancellationToken));
            ProjectWithOneList project = await(LoadProjectAsync(cancellationToken));

            await(RefreshProjectAsync(project, cancellationToken));
        }
Exemple #2
0
        /// <summary>
        /// Create, save and refresh projects
        /// </summary>
        public void SaveLoadAndRefreshProjectWithOneList()
        {
            SaveProject();
            ProjectWithOneList project = LoadProject();

            RefreshProject(project);
        }
 public async Task RefreshProjectAsync(ProjectWithOneList project, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (ISession session = OpenSession())
         using (ITransaction tx = session.BeginTransaction())
         {
             //The project is refreshed and Scenario1, Scenario2 and Scenario3 properties can be set
             //This will succeed when the scenario list is set and accessed during the set but only for
             //Scenario 2 and Scenario3. It will fail if the scenario list is accessed during the set for Scenario1
             await(session.RefreshAsync(project, cancellationToken));
         }
 }
Exemple #4
0
 public void RefreshProject(ProjectWithOneList project)
 {
     using (ISession session = OpenSession())
         using (ITransaction tx = session.BeginTransaction())
         {
             //The project is refreshed and Scenario1, Scenario2 and Scenario3 properties can be set
             //This will succeed when the scenario list is set and accessed during the set but only for
             //Scenario 2 and Scenario3. It will fail if the scenario list is accessed during the set for Scenario1
             session.Refresh(project);
         }
 }
Exemple #5
0
        public ProjectWithOneList SaveProject( )
        {
            ProjectWithOneList project;
            
            using( ISession session = OpenSession( ) )
            using( ITransaction tx = session.BeginTransaction( ) )
            {
                //Create a project scenario
                project = new ProjectWithOneList();
                Scenario scenario = new Scenario( );
               
                //Add the scenario to both lists 
                project.ScenarioList1.Add(scenario);

                //Set the primary key on the project
                project.Name = "Test";

                //Save the created project
                session.Save( project );

                tx.Commit( );
            }
            return project;
        }
        public async Task <ProjectWithOneList> SaveProjectAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            ProjectWithOneList project;

            using (ISession session = OpenSession( ))
                using (ITransaction tx = session.BeginTransaction( ))
                {
                    //Create a project scenario
                    project = new ProjectWithOneList();
                    Scenario scenario = new Scenario( );

                    //Add the scenario to both lists
                    project.ScenarioList1.Add(scenario);

                    //Set the primary key on the project
                    project.Name = "Test";

                    //Save the created project
                    await(session.SaveAsync(project, cancellationToken));

                    await(tx.CommitAsync(cancellationToken));
                }
            return(project);
        }
Exemple #7
0
        public ProjectWithOneList SaveProject( )
        {
            ProjectWithOneList project;

            using (ISession session = OpenSession( ))
                using (ITransaction tx = session.BeginTransaction( ))
                {
                    //Create a project scenario
                    project = new ProjectWithOneList();
                    Scenario scenario = new Scenario( );

                    //Add the scenario to both lists
                    project.ScenarioList1.Add(scenario);

                    //Set the primary key on the project
                    project.Name = "Test";

                    //Save the created project
                    session.Save(project);

                    tx.Commit( );
                }
            return(project);
        }
Exemple #8
0
        public void RefreshProject(ProjectWithOneList project)
        {

            using (ISession session = OpenSession())
            using (ITransaction tx = session.BeginTransaction())
            {
							//The project is refreshed and Scenario1, Scenario2 and Scenario3 properties can be set
                //This will succeed when the scenario list is set and accessed during the set but only for
                //Scenario 2 and Scenario3. It will fail if the scenario list is accessed during the set for Scenario1
                session.Refresh(project);
            }
        }