Example #1
0
        private void InitDocStore(RavenConnectionDialogViewModel conn)
        {
            if (conn == null)
            {
                throw new ArgumentNullException("conn", "conn is null.");
            }



            var assemblies = conn.GetAssemblyPaths().Select(Path.GetFileNameWithoutExtension).Select(Assembly.Load);

            var docStoreCreatorType = (from a in assemblies
                                       from t in a.TypesImplementing <ICreateDocumentStore>()
                                       select t).FirstOrDefault();

            if (docStoreCreatorType != null)
            {
                var docStoreCreator = (ICreateDocumentStore)docStoreCreatorType.CreateInstance();
                _docStore = docStoreCreator.CreateDocumentStore(new ConnectionInfo
                {
                    Url             = conn.Url,
                    DefaultDatabase = conn.DefaultDatabase,
                    Credentials     = new NetworkCredential
                    {
                        UserName = conn.Username,
                        Password = conn.Password
                    },
                    ResourceManagerId = conn.ResourceManagerId,
                    ApiKey            = conn.ApiKey
                });
            }
            else
            {
                _docStore = conn.CreateDocStore();
            }

            _docStore.Initialize();
        }
Example #2
0
 public override IEnumerable <string> GetAssembliesToAdd(IConnectionInfo cxInfo)
 {
     // load user's assemblies
     return(_connInfo.GetAssemblyPaths());
 }