示例#1
0
        private static void AddConfig()
        {
            Configuration config = new Configuration();
            config.Name = "SiteSettings";
            config.Config = "<SiteSettings><Title>Keyvan.FM</Title><Description>The podcast channel of Keyvan Nayyeri about software development, computer science, and technology.</Description><PageSize>10</PageSize><AdminPageSize>20</AdminPageSize></SiteSettings>";
            config.DateAdded = DateTime.UtcNow;

            ConfigurationService service = new ConfigurationService();
            service.AddConfiguration(config);
        }
        public void AddConfiguration(Configuration configuration)
        {
            configuration.DateAdded = DateTime.UtcNow;

            using (IDocumentSession session = Program.documentStore.OpenSession())
            {
                session.Store(configuration);
                session.SaveChanges();
            }
        }