ravendb

Raven DB - Have it Auto Generate its own Key

一曲冷凌霜 提交于 2019-12-04 07:45:32
I current have an object that has a public property called Id. When I store the object, I would like the Id to be part of the Data and not become the document Id like it currently does. When creating the document store I only set the connection string. using (var session = documentStore.OpenSession()) { session.Store(a); session.SaveChanges(); } a can be thought of an object as: public class A { public Guid Id { get; set; } //other properties } So either I want it to generate a random Id or have both the data and the documentId being the Id property of class A. EDIT: So two possibilities: 1.

Can't create new DB in RavenDB 2.x

岁酱吖の 提交于 2019-12-04 07:40:14
Noob RavenDB question: Just brought down Raven 2.x and set it up to run in IIS. Just trying to create a new DB in RavenDB 2.x through the Studio. I have the following set in my configuration: <add key="Raven/AnonymousAccess" value="All"/> I have the physical location set to allow Everyone full control. When I try to create a new database, I get the following: Could not get authorization for this command. If you should have access to this operation contact your admin and check the Raven/AnonymousAccess or the Windows Authentication settings in RavenDB Server Error: The operation '/admin

Managing RavenDb session in Windsor under NServiceBus

不羁的心 提交于 2019-12-04 07:34:15
I'm using NServiceBus (3.2.2), RavenDB (1.2.2017-Unstable) and Windsor (3.0.0.4001) in an MVC 4 project. I have a IHandleMessages class that handles 3 different messages, and that needs an IDocumentSession, and therefore defines a property such as: public IDocumentSession DocumentSession { get; set; } I've copied the RavenDbUnitOfWork implementation from NServiceBus' website I've registered IDocumentStore, IDocumentSession and IManageUnitsOfWork in my Windsor container as follow: container.Register( Component .For<IManageUnitsOfWork>() .ImplementedBy<RavenUnitOfWork>() .LifestyleTransient() );

RavenDB. How to load document with only 5 items from inner collection?

孤者浪人 提交于 2019-12-04 07:27:07
Here is a document in the store: { "Name": "Hibernating Rhinos", "Employees": [ { "Name": "Ayende" }, { "Name": "John" }, { "Name": "Bob" }, { "Name": "Tom" }, { "Name": "Lane" }, { "Name": "Bill" }, { "Name": "Tad" } ] } It is easy to load this document with or without Employees collection, but how to load only part of inner collection? For instance, first 5 items: { "Name": "Hibernating Rhinos", "Employees": [ { "Name": "Ayende" }, { "Name": "John" }, { "Name": "Bob" }, { "Name": "Tom" }, { "Name": "Lane" } ] } Ayende Rahien Not directly, not. What you can do is define the following index:

How to query items from nested collections in Raven DB?

霸气de小男生 提交于 2019-12-04 07:24:08
I have following 2 entity models: public class Store : IModel { public string Id { get; set; } public string Name { get; set; } public string MainPageUrl { get; set; } public ICollection<Product> Products { get; set; } } public class Product : IModel { public string Id { get; set; } public string Name { get; set; } public double Price { get; set; } public DateTime Created { get; set; } } and of these Store is a document in my Raven Db. I need to create an index where I can query products by Name and the result should be partial Store documents containing only matching products. So to be

Multi-tenanted DB. Strategy for Document ID and authorization

半腔热情 提交于 2019-12-03 21:50:44
I'm weighing up having separate DBs (one per company) vs one multi-tenanted DB (with all companies). Criteria: A user can belong to one company only and can't access documents of other companies. An administrator of the system needs to maintain DBs for all firms. Number of companies/tenants - from hundreds to tens of thousands There is one entry point with authentication, for all companies/tenants (it'll resolve the tenant and address it to the right DB). Question #1 . Are there any "good practices" for designing a multi-tenanted database in RavenDB? There is a similar post for MongoDB . Would

Querying a child collection by multiple values in RavenDB

可紊 提交于 2019-12-03 20:10:41
问题 I'm using RavenDB build 371 and I have the following model: class Product { public string Id { get; set; } public ProductSpec[] Specs { get; set; } } class ProductSpec { public string Name { get; set; } public string Value { get; set; } } I would like to be able to query for products which have a set of specs. When querying by a single spec: session.Query<Product>() .Where(product => product.Specs.Any(spec => spec.Name == "Color" && spec.Value == "Red")) .ToList(); The expected results are

Implementing the repository and service pattern with RavenDB

我们两清 提交于 2019-12-03 16:58:43
问题 I have some difficulties implementing the repository and service pattern in my RavenDB project. The major concern is how my repository interface should look like because in RavenDB I use a couple of indexes for my queries. Let's say I need to fetch all items where the parentid equals 1. One way is to use the IQueryable List() and get all documents and then add a where clause to select the items where the parentid equals 1. This seems like a bad idea because I can't use any index features in

using RavenDB with ServiceStack

心已入冬 提交于 2019-12-03 13:36:29
问题 I read this post by Phillip Haydon about how to use NHibernate/RavenDB with ServiceStack. I don't see the point about getting the IDocumentStore and open new session every time i need something from the db like this: public class FooService : ServiceBase<Foo> { public IDocumentStore RavenStore{ get; set; } protected override object Run(ProductFind request) { using (var session = RavenStore.OpenSession()) { // Do Something... return new FooResponse{/*Object init*/}; } } } Why cant i just use

Is it possible to work with OrientDB using C#?

冷暖自知 提交于 2019-12-03 12:09:16
Are there any implementations, api or examples of OrientDB and C#. The reason I am looking at OrientDB is becuase it's the only one that I found that is a combination of Graph and Document. Any suggestions on how I should try this. My next choice is RavenDB, but I am not sure if it supports joins or linked documents? Any thoughts... I just developed a first version of a REST client for OrientDB. http://netorientdb.codeplex.com Roman Gordon OrientDB has an official binary driver for .NET look here http://orientdb.com/docs/3.0.x/ Example of usage OrientDB-NET.binary string release = OClient