The name "NodaTimeField" does not exist in the current context error during the installation of the index on RavenDB

I am using NodaTime LocalDate in the RavenDB index. Here is an example index:

public class TaskIndex : AbstractIndexCreationTask<ScheduleTask>
{
    public TaskIndex()
    {
        Map = tasks => from task in tasks
            select new
            {
                task.Name,
                PlannedStartDate = task.PlannedStartDate.AsLocalDate().Resolve(),
                PlannedDueDate = task.PlannedDueDate.AsLocalDate().Resolve()
            };

        Index(x => x.Name, FieldIndexing.Analyzed);
        Store(x => x.Name, FieldStorage.Yes);
        TermVector(x => x.Name, FieldTermVector.WithPositionsAndOffsets);
    }
}

I installed the RavenDB-NodaTime package as described here .

Here is the code snippet that I use to set the index:

var assembly = AppDomain.CurrentDomain.Load(new AssemblyName
{
    Name = "cs.Scheduling"
});
var catalog = new AssemblyCatalog(assembly);
var provider = new CompositionContainer(catalog);
var commands = documentStore.DatabaseCommands.ForDatabase(dbName);
IndexCreation.CreateIndexes(provider, commands, documentStore.Conventions);

documentStoreconfigured with the default database, but then I use it to set the index to another (tenant) database name that is included in dbName.

During installation, the index I got exception The name 'NodaTimeField' does not exist in the current context.

, , . , , RavenDB.

, , :

embeddableDocumentStore.ServerIfEmbedded.Options.DatabaseLandlord.SetupTenantConfiguration += configuration =>
            {
                configuration.Catalog.Catalogs.Add(new TypeCatalog(typeof(DeleteOnConflict)));
                configuration.Catalog.Catalogs.Add(new TypeCatalog(typeof(PutOnConflict)));
            };

RavenDB, , - 2.5.2956.
RavenDB.Client.NodaTime - 2.5.10.

. .

+4
2

. RavenDB , . RavenDB (.. \Program Files (x86)\RavenDB). RavenDB-NodaTime, (\Program Files (x86)\RavenDB).

RavenDB , , .

, - .

PS. db (RavenDB , "yyyy-MM-dd" LocalDate), store.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); store.Initialize(); Steven .

+1

, , . ( Raven 3) -

"Raven/ActiveBundles": "Encryption;Compression;NodaTime"

store.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);

store.Initialize(). , , ( , ). , "2016-2-3", .

0

Source: https://habr.com/ru/post/1625974/


All Articles