Пример #1
0
 public SwitchDatabase(CouchSession session, string database)
 {
     this.session  = session;
     this.database = database;
     this.session.PushDatabase();
     this.session.Use(database);
 }
Пример #2
0
 public DesginDocuments(CouchSession session, string name)
 {
     this.session   = session;
     this.Documents = session.Documents;
     this.name      = name;
     this.basePath  = "_design/" + name;
 }
Пример #3
0
        public static void SetDesignDocumentsFromAssembly(CouchSession session, Assembly assembly, Dictionary <string, string> databaseOverrides = null)
        {
            databaseOverrides = databaseOverrides ?? new Dictionary <string, string>();

            var designDocs = GetDesignDocuments(assembly);

            if (session.Db.Get() == null)
            {
                session.Db.Create();
            }

            var defaultDb = session.DatabaseName;

            foreach (var databaseOverride in databaseOverrides)
            {
                using (session.Switch(databaseOverride.Value))
                {
                    if (session.Db.Get() == null)
                    {
                        session.Db.Create();
                    }
                }
            }

            foreach (var doc in designDocs)
            {
                using (session.Switch(databaseOverrides.ContainsKey(doc.Key) ? databaseOverrides[doc.Key] : defaultDb))
                {
                    session.Design(doc.Key).SetDocument(doc.Value);
                }
            }
        }
Пример #4
0
 public Users(CouchSession session)
 {
     this.session = session;
 }
Пример #5
0
 public BulkDocuments(CouchSession session)
 {
     this.session = session;
 }
Пример #6
0
 public Changes(CouchSession session)
 {
     this.session  = session;
     this.basePath = "_changes";
 }
Пример #7
0
 public Databases(CouchSession session)
 {
     this.session = session;
 }
Пример #8
0
 public static void SetDesignDocumentsFromAssembly <T>(CouchSession session, Dictionary <string, string> databaseOverrides = null)
 {
     SetDesignDocumentsFromAssembly(session, typeof(T).Assembly, databaseOverrides);
 }