Пример #1
0
        /// <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));
        }
Пример #2
0
        /// <summary>
        /// Create, save and refresh projects
        /// </summary>
        public void SaveLoadAndRefreshProjectWithOneList()
        {
            SaveProject();
            ProjectWithOneList project = LoadProject();

            RefreshProject(project);
        }
Пример #3
0
 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));
         }
 }
Пример #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);
         }
 }
Пример #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;
        }
Пример #6
0
        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);
        }
Пример #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);
        }
Пример #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);
            }
        }