ravendb

RavenDB Query Documents with Property Removed

我的未来我决定 提交于 2019-12-06 13:24:16
In the RavenDB Studio, I can see 69 CustomVariableGroup documents. My query only returns 66 of them. After some digging, I see that the three docs that are not returned have the new class structure: a property was removed. Since I saved these three CustomVariableGroup documents, their structure is different from the other 66. Why though, when I query for all of them, do I only get the other 66 documents with the old structure? Both my C# code, and my query in LinqPad, only return the 66. Here's the LinqPad query: Session.Query<CustomVariableGroup>().Dump(); // returns 66 docs But, if I do this

RavenDB does not play nicely with Transaction Scope

[亡魂溺海] 提交于 2019-12-06 12:03:26
I have the following test case that i expect to pass. But it does not pass with RavenDB. If i create the exact same test with MsSql, it does pass. var connectionString = "Url=http://localhost:8080"; var store = new DocumentStore(); store.ParseConnectionString(connectionString); store.Initialize(); using (var scope = new TransactionScope()) using (var session = store.OpenSession()) { session.Store(dog); session.SaveChanges(); var dogs = session.Query<Dog>().Customize(x => x.WaitForNonStaleResults()).ToList(); Assert.AreEqual(1, dogs.Count); scope.Complete(); } I am trying to write some code

Custom model binder with inheritance using Web API and RavenDB

本小妞迷上赌 提交于 2019-12-06 11:27:42
问题 I'm developing a simple web app where I need to bind all types implementing and interface of a specific type. My interface has one single property like this public interface IContent { string Id { get;set; } } a common class using this interface would look like this public class Article : IContent { public string Id { get;set; } public string Heading { get;set; } } to be clean here the article class is just one of many different classes implementing IContent so therefor I need a generic way

Use RavenDB as the database for an Orchard CMS module

纵饮孤独 提交于 2019-12-06 09:05:42
I'm just getting underway with Orchard CMS. How difficult would it be to create an Orchard module that uses RavenDB as its database? Is a hard dependency on SQL and NHibernate baked deeply into Orchard? All of Orchard's core features are based on NHibernate so it would be difficult to move the entire Orchard database to another DBMS not supported by NHibernate. However, Orchard is very extensible and it is quite easy to access all kinds of custom data sources from your own modules. For example, I am currently working in a project where we store our data in a graph database (neo4j) and access

How to do a cross join / cartesian product in RavenDB?

倾然丶 夕夏残阳落幕 提交于 2019-12-06 08:13:51
I have a web application that uses RavenDB on the backend and allows the user to keep track of inventory. The three entities in my domain are: public class Location { string Id string Name } public class ItemType { string Id string Name } public class Item { string Id DenormalizedRef<Location> Location DenormalizedRef<ItemType> ItemType } On my web app, there is a page for the user to see a summary breakdown of the inventory they have at the various locations. Specifically, it shows the location name, item type name, and then a count of items. The first approach I took was a map/reduce index

RavenDB: Why do I get null-values for fields in this multi-map/reduce index?

独自空忆成欢 提交于 2019-12-06 07:24:49
Inspired by Ayende's article https://ayende.com/blog/89089/ravendb-multi-maps-reduce-indexes , I have the following index, that works as such: public class Posts_WithViewCountByUser : AbstractMultiMapIndexCreationTask<Posts_WithViewCountByUser.Result> { public Posts_WithViewCountByUser() { AddMap<Post>(posts => from p in posts select new { ViewedByUserId = (string) null, ViewCount = 0, Id = p.Id, PostTitle = p.PostTitle, }); AddMap<PostView>(postViews => from postView in postViews select new { ViewedByUserId = postView.ViewedByUserId, ViewCount = 1, Id = (string) postView.PostId, PostTitle =

Membership reboot replace Ninject with Simple Injector

泪湿孤枕 提交于 2019-12-06 06:16:02
问题 I need add membership reboot (RavenDb) into the project that use IOC Simple Injector Ninject implementation var config = MembershipRebootConfig.Create(); kernel.Bind<MembershipRebootConfiguration<HierarchicalUserAccount>>().ToConstant(config); kernel.Bind<UserAccountService<HierarchicalUserAccount>>().ToSelf(); kernel.Bind<AuthenticationService<HierarchicalUserAccount().To<SamAuthenticationService<HierarchicalUserAccount>>(); kernel.Bind<IUserAccountRepository<HierarchicalUserAccount>>()

Filter a static RavenDB map/reduce index

こ雲淡風輕ζ 提交于 2019-12-06 06:07:49
Scenario/Context Raven 2.0 on RavenHQ Web app, so async is preferred My application is a survey application. Each Survey has an array of Questions ; and conversely, each Submission (an individual's response to a survey) has an array of Answers . I have a static index that aggregates all answers so that I can display a chart based on the responses (e.g. for each question on each survey, how many people selected each option). These data are used to render, for example, a pie chart. This aggregation index (discussed in this question ) basically gives an object per question per survey, with sums

Using RavenDB as a persistent cache

早过忘川 提交于 2019-12-06 05:38:49
I have currently have a web application that caches a large amount of data (several hundred thousand entries) in memory for quick lookup and then in SQL Server as a persistent cache. Basically the information consists of geocodes of addresses where the geocode is retrieved via a remote web service which takes time if needed to be called continuously rather than cached. Would using RavenDB (or other suggestions) be a better way of caching this information in a persistent store in terms of both speed and memory? Currently the app is hosted on a server which SQL Server sucks most of the memory

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

本秂侑毒 提交于 2019-12-06 03:44:15
问题 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" }, {