ravendb

JsonSerializationException for type with private constructor

放肆的年华 提交于 2019-12-08 04:11:24
问题 I am persisting NLog logging statements to my RavenDb database. The LogEventInfo class, which represents a log statement, has a property, LogLevel , with a private constructor. Instances of LogLevel (Info, Warn, etc.) are created via static, readonly properties that call the private constructor. The problem is that I wish to read the messages out of the database and querying for them is throwing a Json.Net serialization error: Unable to find a constructor to use for type NLog.LogLevel. A

RavenDB IEnumerable vs List

老子叫甜甜 提交于 2019-12-08 03:49:11
问题 I have some behavior that I don't understand. I'm using RavenDB, and I'm using a session for each unit of work: When a logic class calls the RavenDB data access layer (DAL), a new session is created. Within the DAL, other DAL classes and methods can be invoked, but just one session will be used. The part I don't understand is the difference between using IEnumerable and List within the GetMostRecentByStartTime() method below. In that method, using List just like what's shown, this is my

Using RavenDB as a persistent cache

一个人想着一个人 提交于 2019-12-08 01:14:25
问题 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

Use RavenDB as the database for an Orchard CMS module

北慕城南 提交于 2019-12-07 22:53:24
问题 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? 回答1: 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

Does multi map/reduce work in RavenDb?

点点圈 提交于 2019-12-07 09:30:09
问题 I've read Ayende's blog post on the multi map feature of RavenDB and have tried to implement it. I cannot get it to work through. What I have is basically the same as the example in the blog post: class RootDocument { public string Id { get; set; } public string Foo { get; set; } public string Bar { get; set; } } public class ChildDocument { public string Id { get; set; } public string RootId { get; set; } public int Value { get; set; } } class RootsByIdIndex:

RavenDB Include - Session.Load<T>(string[] ids)

大兔子大兔子 提交于 2019-12-07 07:38:50
问题 Is there a reason why I can't perform an Include to include a collection of documents from a query, then load them all in one query, rather than using a for-loop. var messages = Session.Query<MessageRecipient, MessageInboxIndex>() .Include(x => x.MessageId) .ToList(); Session.Load<Message>(messages.Select(x => x.MessageId)); This seems to go back to the database to fetch the objects rather than use the cache...is this by design or can it be fixed? Paul 回答1: Paul, I just submitted a pull

ravendb, castle IoC ,Wcf facility - doc session liefstyle

陌路散爱 提交于 2019-12-07 05:26:59
问题 What's the recommended lifestyle for raven doc session and store under a windsor ioc, wcf facility setup hosted in IIS? I keep seeing this error: Error TempPathInUse (JET_errTempPathInUse, Temp path already used by another database instance)` here is my setup: public class RavenInstaller : IWindsorInstaller { public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register( Component.For<IDocumentStore>().ImplementedBy<DocumentStore>() .DependsOn(new {

Querying a Dictionary with RavenDb

僤鯓⒐⒋嵵緔 提交于 2019-12-07 02:48:36
问题 I have a class defined as: public class Student { public string Id { get; set; } public IDictionary<string, string> Attributes { get; set; } } based on the discussion I found here : http://groups.google.com/group/ravendb/browse_thread/thread/88ea52620021ed6c?pli=1 I can store an instance quite easily as : //creation using (var session = store.OpenSession()) { //now the student: var student = new Student(); student.Attributes = new Dictionary<string, string>(); student.Attributes["NIC"] =

RavenDB dynamic objects

喜你入骨 提交于 2019-12-07 02:39:54
问题 I have code that looks something like this: using (var session = DocumentStore.OpenSession()) { var dbItem = session.Load<dynamic>(item.Id); if (dbItem is DynamicJsonObject) { dbItem["PropertyName"] = "new value"; } session.SaveChanges(); } What I can't figure out is how to update properties of the dbItem. Does anyone know what to do? I have tried accessing the property name directly like this: dbItem.PropertyName I have also tried casting to ExpandoObject, IDictionary and more. But nothing

Updating documents in RavenDB

限于喜欢 提交于 2019-12-06 17:16:50
问题 If you add, delete or rename a property on a persisted entity, what's the easiest way to update the documents in RavenDB? 回答1: RavenDB supports PATCH commands, see the docs for more info for more info. This way you can update a document directly without having to pull it from the server, update it and then send it back. Also you can run patches over multiple documents by using Set-based queries, see here for some more info. This lets you do the equivalent of UPDATE Users SET IsActive = false