Пример #1
0
        public IActionResult Run()
        {
            #region Demo
            #region Step_1
            RevisionsConfiguration myRevisionsConfiguration = new RevisionsConfiguration
            {
                Default = new RevisionsCollectionConfiguration
                {
                    Disabled = false
                }
            };

            ConfigureRevisionsOperation revisionsConfigurationOperation = new ConfigureRevisionsOperation(myRevisionsConfiguration);
            DocumentStoreHolder.Store.Maintenance.Send(revisionsConfigurationOperation);
            #endregion

            List <Company> revisions;

            using (IDocumentSession session = DocumentStoreHolder.Store.OpenSession())
            {
                #region Step_2
                Company company = session.Load <Company>("companies/7-A");

                company.Name = "Name 1";
                session.CountersFor("companies/7-A").Increment("MyCounter", 100);
                session.SaveChanges();

                company.Name  = "Name 2";
                company.Phone = "052-1234-567";
                session.SaveChanges();
                #endregion

                #region Step_3
                revisions = session
                            .Advanced
                            .Revisions
                            .GetFor <Company>("companies/7-A", start: 0, pageSize: 25);
                #endregion
            }
            #endregion

            return(Ok(revisions));
        }