This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var builder = new ContainerBuilder(); | |
builder.RegisterInstance(store) | |
.As<IDocumentStore>() | |
.SingleInstance(); | |
builder.Register(ctx => ctx.Resolve<IDocumentStore>().OpenSession()) | |
.As<IDocumentSession>() | |
.InstancePerLifetimeScope(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GenerateIdFor<T>(this IDocumentSession session) | |
{ | |
// We need the advanced session in order to ensure that the keys are generated in the correct database. | |
// session.Advanced.DocumentStore.DatabaseCommands is not sufficient. | |
var advancedSession = session.Advanced as DocumentSession; | |
if (advancedSession == null) | |
throw new InvalidOperationException(); | |
// An entity instance is required to generate a key, but we only have a type. | |
// In our case, the entities don't have public constructors so we must use reflection. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using Raven.Client.Embedded; | |
using Raven.Client.Indexes; | |
using Xunit; | |
namespace RavenTests | |
{ | |
public class Tests | |
{ | |
[Fact] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using Raven.Client.Embedded; | |
using Raven.Client.Indexes; | |
using Xunit; | |
namespace RavenTests | |
{ | |
public class Tests | |
{ | |
[Fact] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using Raven.Abstractions.Data; | |
using Raven.Client; | |
using Raven.Client.Bundles.Versioning; | |
using Raven.Client.Document; | |
using Raven.Client.Extensions; | |
using Xunit; | |
namespace RavenTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Raven.Client.Embedded; | |
using Raven.Json.Linq; | |
using Xunit; | |
namespace RavenTests | |
{ | |
public class Tests | |
{ | |
[Fact] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Appointment | |
{ | |
public string Id { get; set; } | |
public DateTimeOffset AppointmentTime { get; set; } | |
public string TimeZone { get; set; } | |
} | |
public class Appointments_CountsByDate : AbstractIndexCreationTask<Appointment, Appointments_CountsByDate.Result> | |
{ | |
public class Result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Raven.Client.Embedded; | |
using Xunit; | |
namespace RavenTests | |
{ | |
public class Tests | |
{ | |
[Fact] | |
public void Can_Save_And_Load_DateTimeOffset_From_Metadata() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal static void WaitForIndexToBecomeNonStale(this DocumentDatabase database, string name, DateTime? cutOff, Guid? cutoffEtag) | |
{ | |
var task = Task.Factory.StartNew(() => | |
{ | |
while (true) | |
{ | |
var stale = true; | |
database.TransactionalStorage.Batch(x => | |
{ | |
stale = x.Staleness.IsIndexStale(name, cutOff, cutoffEtag); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using Raven.Client.Embedded; | |
using Xunit; | |
namespace RavenTests | |
{ | |
public class Tests | |
{ | |
[Fact] |
OlderNewer