本文整理汇总了C#中Raven.Client.Document.DocumentStore.ParseConnectionString方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentStore.ParseConnectionString方法的具体用法?C# DocumentStore.ParseConnectionString怎么用?C# DocumentStore.ParseConnectionString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Raven.Client.Document.DocumentStore
的用法示例。
在下文中一共展示了DocumentStore.ParseConnectionString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureWellFormedConnectionStrings_ParsingWithEndingSemicolons_Successful
public void EnsureWellFormedConnectionStrings_ParsingWithEndingSemicolons_Successful()
{
var documentStore = new DocumentStore();
documentStore.ParseConnectionString("Url=http://localhost:10301;");
Assert.DoesNotContain(";", documentStore.Url);
documentStore.ParseConnectionString("Url=http://localhost:10301/;");
Assert.DoesNotContain(";", documentStore.Url);
}
示例2: RavenDataProvider
public RavenDataProvider(string connectionString)
: base(connectionString)
{
_store = new DocumentStore();
_store.ParseConnectionString(connectionString);
_store.Initialize();
}
示例3: InitializeDocumentsCursor
private async Task InitializeDocumentsCursor(CancellationToken cancellation)
{
using (var store = new DocumentStore())
{
store.ParseConnectionString(configuration.ConnectionString);
store.Initialize(false);
using (var session = store.OpenAsyncSession())
{
if (String.IsNullOrEmpty(configuration.Query))
{
documentsCursor = await session.Advanced.StreamAsync<RavenJObject>(Etag.Empty, 0, int.MaxValue, null, cancellation);
}
else
{
var query = String.IsNullOrEmpty(configuration.Index)
? session.Advanced.AsyncDocumentQuery<RavenJObject>()
: session.Advanced.AsyncDocumentQuery<RavenJObject>(configuration.Index);
// Streaming query API does not create a dynamic index, so user have to specify one if query is provided: http://issues.hibernatingrhinos.com/issue/RavenDB-1410
documentsCursor = await session.Advanced.StreamAsync<RavenJObject>(
query.Where(configuration.Query).NoCaching().NoTracking(), cancellation);
}
}
}
}
示例4: CreateStore
private static DocumentStore CreateStore(string connectionString, bool createDatabase)
{
var store = new DocumentStore();
store.ParseConnectionString(connectionString);
store.Initialize(createDatabase);
return store;
}
示例5: check_illegal_connstrings
public void check_illegal_connstrings()
{
using (var store = new DocumentStore())
{
Assert.Throws<System.ArgumentException>(() => store.ParseConnectionString(string.Empty));
}
}
示例6: RavenDataProvider
public RavenDataProvider(string connectionString)
: base(connectionString)
{
_store = new DocumentStore();
_store.ParseConnectionString(connectionString);
_store.Initialize();
_aggressiveCacheFor = TimeSpan.FromSeconds(60);
}
示例7: Can_get_api_key
public void Can_get_api_key()
{
using (var store = new DocumentStore())
{
store.ParseConnectionString("Url=http://localhost:8079/;ApiKey=d5723e19-92ad-4531-adad-8611e6e05c8a;");
Assert.Equal("d5723e19-92ad-4531-adad-8611e6e05c8a", store.ApiKey);
}
}
示例8: Create
public IDocumentStore Create()
{
if (IsEmpty())
{
var defaultDataDirectory = AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ParentDirectory().AppendPath("data");
return new RavenDbSettings {DataDirectory = defaultDataDirectory}.Create();
}
if (Url.IsNotEmpty())
{
var store = new DocumentStore
{
Url = Url
};
if (ConnectionString.IsNotEmpty())
{
store.ParseConnectionString(ConnectionString);
}
return store;
}
if (DataDirectory.IsNotEmpty())
{
return new EmbeddableDocumentStore
{
DataDirectory = DataDirectory,
UseEmbeddedHttpServer = UseEmbeddedHttpServer
};
}
if (RunInMemory)
{
var store = new EmbeddableDocumentStore
{
RunInMemory = true,
UseEmbeddedHttpServer = UseEmbeddedHttpServer
};
if (Url.IsNotEmpty())
{
store.Url = Url;
}
if (Port > 0)
{
store.Configuration.Port = Port;
}
return store;
}
throw new ArgumentOutOfRangeException("settings");
}
示例9: RunActivitiesImport
public void RunActivitiesImport()
{
var store = new DocumentStore();
store.ParseConnectionString("Url=http://localhost:8888/");
store.Initialize();
using (IDocumentSession db = store.OpenSession())
{
var importer = Importer.CreateImporter(db, new ActivitiesMapping());
importer.Import(@"C:\Work\pressures-data\Human_Activities_Metadata_Catalogue.csv");
}
}
示例10: TestConnectionAsync
/// <summary>
/// Tests the RavenDB connection.
/// </summary>
/// <param name="connectionString">RavenDB connection string to use to connect.</param>
public async Task TestConnectionAsync(string connectionString)
{
if (String.IsNullOrEmpty(connectionString))
throw Errors.ConnectionStringMissing();
using (var store = new DocumentStore())
{
store.ParseConnectionString(connectionString);
store.Initialize(false);
await store.AsyncDatabaseCommands.GetStatisticsAsync();
}
}
示例11: can_work_with_default_db
public void can_work_with_default_db()
{
using (var store = new DocumentStore())
{
store.ParseConnectionString("Url=http://localhost:8079/;DefaultDatabase=DevMachine;ResourceManagerId=d5723e19-92ad-4531-adad-8611e6e05c8a;");
Assert.Equal("http://localhost:8079", store.Url);
Assert.Equal("http://localhost:8079 (DB: DevMachine)", store.Identifier);
Assert.NotNull(store.Credentials);
Assert.Equal("DevMachine", store.DefaultDatabase);
Assert.True(store.EnlistInDistributedTransactions);
}
}
示例12: check_url_and_rmid
public void check_url_and_rmid()
{
using (var store = new DocumentStore())
{
store.ParseConnectionString("Url=http://localhost:8079/;ResourceManagerId=d5723e19-92ad-4531-adad-8611e6e05c8a;");
Assert.Equal("http://localhost:8079", store.Url);
Assert.Equal("http://localhost:8079", store.Identifier);
Assert.NotNull(store.Credentials);
Assert.Null(store.DefaultDatabase);
Assert.True(store.EnlistInDistributedTransactions);
}
}
示例13: Load
public override void Load()
{
var connStr = ConfigurationManager.AppSettings["RAVENHQ_CONNECTION_STRING"];
var store = new DocumentStore();
store.ParseConnectionString(connStr);
store.Initialize();
Kernel.Bind<IDocumentSession>()
.ToMethod(ctx => store.OpenSession())
.InRequestScope();
this.BindFilter<RavenFilter>(FilterScope.Controller, 0);
}
示例14: WillNotAffectResourceManagerId
public void WillNotAffectResourceManagerId()
{
var resourceManagerId = Guid.NewGuid();
using (var store = new DocumentStore
{
ResourceManagerId = resourceManagerId
})
{
store.ParseConnectionString("Url=http://localhost:8079/;");
Assert.Equal(resourceManagerId, store.ResourceManagerId);
}
}
示例15: check_url_and_defaultdb
public void check_url_and_defaultdb()
{
using (var store = new DocumentStore())
{
store.ParseConnectionString("Url=http://localhost:8079/;DefaultDatabase=DevMachine;");
Assert.Equal("http://localhost:8079", store.Url);
Assert.Equal("http://localhost:8079 (DB: DevMachine)", store.Identifier);
Assert.NotNull(store.ResourceManagerId);
Assert.NotNull(store.Credentials);
Assert.Equal("DevMachine", store.DefaultDatabase);
Assert.True(store.EnlistInDistributedTransactions);
}
}