ravendb

RavenDB: Add auto increment to other property than ID

a 夏天 提交于 2020-02-21 04:46:18
问题 Is there a way to put an attribute on a property to tell RavenDB to use this property just like the ID-property and put an auto increment on it? Pseudo-code: public class MyObj { public string Id { get; set; } [Increment] public int OtherProp { get; set; } } 回答1: Dynamicus points to the correct solution, but I'd like to give the exact sample-code for helping other Stackoverflow-users and maybe also making the solution more searchable. In relation to the question's example-code, here is the

RavenDB: Add auto increment to other property than ID

▼魔方 西西 提交于 2020-02-21 04:46:13
问题 Is there a way to put an attribute on a property to tell RavenDB to use this property just like the ID-property and put an auto increment on it? Pseudo-code: public class MyObj { public string Id { get; set; } [Increment] public int OtherProp { get; set; } } 回答1: Dynamicus points to the correct solution, but I'd like to give the exact sample-code for helping other Stackoverflow-users and maybe also making the solution more searchable. In relation to the question's example-code, here is the

RavenDB: Add auto increment to other property than ID

只愿长相守 提交于 2020-02-21 04:46:10
问题 Is there a way to put an attribute on a property to tell RavenDB to use this property just like the ID-property and put an auto increment on it? Pseudo-code: public class MyObj { public string Id { get; set; } [Increment] public int OtherProp { get; set; } } 回答1: Dynamicus points to the correct solution, but I'd like to give the exact sample-code for helping other Stackoverflow-users and maybe also making the solution more searchable. In relation to the question's example-code, here is the

Update Document with external object

北慕城南 提交于 2020-02-05 04:07:05
问题 i have a database containing Song objects. The song class has > 30 properties. My Music Tagging application is doing changes on a song on the file system. It then does a lookup in the database using the filename. Now i have a Song object, which i created in my Tagging application by reading the physical file and i have a Song object, which i have just retrieved from the database and which i want to update. I thought i just could grab the ID from the database object, replace the database

Custom analyzer for RavenDB

放肆的年华 提交于 2020-01-17 08:28:29
问题 I need some info on developing a custom analyzer for RavenDB. I'm in the stage of setting up the DLL, the custom analyzer will be pretty simple as I need just a small modification of the StandardAnalyzer. I found this page: http://www.tomdupont.net/2013/05/alphanumeric-lucene-analyzer-for-ravendb.html Obviously it doesn't work out of the box :-) 1) Where do I have to put the custom analyzer DLL? In my hard disk the path of Raven.Database.dll is "D:\ravendb\Server", so I put the Raven

RavenDb entity naming

主宰稳场 提交于 2020-01-16 18:15:42
问题 I am using RavenDB, and I save my documents (which come from a C# class called "FeedPost") with the id: "Posts/[GUID]" (where [GUID] is a guid). Raven DB creates a document, and sets its entity-name to "FeedPosts". Ok - fine. How come, when I go in to Raven Studio and modify a document, the entity-name for that document CHANGES from "FeedPosts" to "Posts"? I BELIEVE it is looking at the Id of the document, but I havent asked it to change the entity-name - why does it just choose to do this?

Query multimap index by Id - The field '__document_id' is not indexed, cannot query on fields that are not indexed

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-16 03:49:25
问题 In RavenDb I have a simple multimap index which looks like below: public class MessageOutboxIndex : AbstractMultiMapIndexCreationTask<MessageOutboxIndex.ReduceResult> { public class ReduceResult { public string Id { get; set; } public string FromAccountId { get; set; } public Core.Enums.Message.MessageStatus OutboxStatus { get; set; } public string ToAccountId { get; set; } public string ToArtistName { get; set; } public DateTimeOffset DateSent { get; set; } public string Subject { get; set;

RavenDB UniqueConstraint doesn't seem to work

与世无争的帅哥 提交于 2020-01-15 03:34:06
问题 I've been trying for a day to get UniqueConstraint working, but it doesn't seem the are. I have a simple MVC6 site that creates a User on a POST. I'm expecting that on the second POST an exception should be thrown as a user will have already been created with the same properties. I'm wanting to ensure that the email address is unique. using Raven.Client; using Raven.Client.Document; using Raven.Client.UniqueConstraints; namespace MVC6Test.DomainModel { public class User { public string Id {

How can you boost documents by recency in RavenDB?

落爺英雄遲暮 提交于 2020-01-14 09:29:07
问题 Is it possible to boost recent documents in a RavenDB query? This question is exactly what I want to do but refers to native Lucene, not RavenDB. For example, if I have a Document like this public class Document { public string Title { get; set; } public DateTime DateCreated { get; set; } } How can I boost documents who's date are closer to a given date, e.g. DateTime.UtcNow ? I do not want to OrderByDecending(x => x.DateCreated) as there are other search parameters that need to affect the

How-to create index on multiple documents with reducing

强颜欢笑 提交于 2020-01-13 05:37:30
问题 I've the following documents : public class User { public string Id { get; set; } public string Email { get; set; } public string Password { get; set; } } public class Book { public string Id { get; set; } public string Title { get; set; } } public class BookFavorite { public string Id { get; set; } public string UserId { get; set; } public string BookId { get; set; } } I want to query the list of books and have an information on each book if user has it in favorite. Actually a result like