private static void RegisterConventions(StoreOptions options) { options.Schema.For<Organization>() .Duplicate(o => o.Slug); options.Schema.For<Campaign>() .ForeignKey<Organization>(d => d.OrganizationId); options.Schema.For<Donor>() .ForeignKey<Organization>(o => o.OrganizationId); options.Schema.For<Donation>() .ForeignKey<Organization>(d => d.OrganizationId) .ForeignKey<Campaign>(d => d.CampaignId) .ForeignKey<Donor>(d => d.DonorId); options.Schema.For<Event>() .ForeignKey<Organization>(e => e.OrganizationId) .Duplicate(e => e.Slug); options.Schema.For<User>() .ForeignKey<Organization>(u => u.OrganizationId) .Duplicate(u => u.EmailAddress); options.Schema.For<Volunteer>() .ForeignKey<Organization>(v => v.OrganizationId); }
public AdvancedOptions(IDocumentCleaner cleaner, StoreOptions options, ISerializer serializer, IDocumentSchema schema) { _serializer = serializer; _schema = schema; Options = options; Clean = cleaner; }
// build out the StoreOptions that you need for your application private static StoreOptions configureStoreOptions() { var options = new StoreOptions(); options.Schema.For<User>(); options.Schema.For<Issue>(); options.Schema.For<Target>(); options.Connection(ConnectionSource.ConnectionString); return options; }
public static void Register(StoreOptions options) { RegisterConventions(options); options.Listeners.Add(new DocumentSessionListener { OnDocumentAddedForStorage = (id, document) => { var idoc = document as IDocument; if (idoc != null) { Ensure.NotEqual(idoc.CreatedUtc, default(DateTime), $"CreatedUtc was not set on doc {id}"); Ensure.NotEqual(idoc.LastModifiedBy, default(Guid), $"LastModifiedBy was not set on doc {id}"); Ensure.NotEqual(idoc.LastModifiedUtc, default(DateTime), $"LastModifiedUtc was not set on doc {id}"); Ensure.NotEqual(idoc.LastModifiedBy, default(Guid), $"LastModifiedBy was not set on doc {id}"); } } }); }
public static MartenConfigurationExpression AddMarten(this IServiceCollection services, StoreOptions options) { services.AddMarten(s => options); return(new MartenConfigurationExpression(services, options)); }
internal void Alter(StoreOptions schema) { _alterations.Each(x => x(schema)); }
public void Configure(IServiceProvider services, StoreOptions options) { _configure(services, options); }
public void Configure(IServiceProvider services, StoreOptions options) { options.InitialData.Add(_data); }
internal MartenConfigurationExpression(IServiceCollection services, StoreOptions options) { _services = services; _options = options; }
public PoliciesExpression(StoreOptions parent) { _parent = parent; }
/// <summary> /// Add Marten IDocumentStore, IDocumentSession, and IQuerySession service registrations /// to your application using the configured StoreOptions /// </summary> /// <param name="services"></param> /// <param name="options">The Marten configuration for this application</param> /// <returns></returns> public static MartenConfigurationExpression AddMarten(this IServiceCollection services, StoreOptions options) { services.AddSingleton <IDocumentStore>(s => { var logger = s.GetService <ILogger <IDocumentStore> >() ?? new NullLogger <IDocumentStore>(); options.Logger(new DefaultMartenLogger(logger)); return(new DocumentStore(options)); }); // This can be overridden by the expression following services.AddSingleton <ISessionFactory, DefaultSessionFactory>(); services.AddScoped(s => s.GetRequiredService <ISessionFactory>().QuerySession()); services.AddScoped(s => s.GetRequiredService <ISessionFactory>().OpenSession()); switch (options.Events.Daemon.Mode) { case DaemonMode.Disabled: // Nothing break; case DaemonMode.Solo: services.AddSingleton <INodeCoordinator, SoloCoordinator>(); services.AddHostedService <AsyncProjectionHostedService>(); break; case DaemonMode.HotCold: services.AddSingleton <INodeCoordinator, HotColdCoordinator>(); services.AddHostedService <AsyncProjectionHostedService>(); break; } return(new MartenConfigurationExpression(services, options)); }
public GeneratedEventDocumentStorage(Marten.StoreOptions options) : base(options) { _options = options; }
public IFirstStoreImplementation1763841752(Marten.StoreOptions options) : base(options) { _options = options; }
public AdvancedOptions(IDocumentCleaner cleaner, StoreOptions options) { Options = options; Clean = cleaner; }
public QuerySession(IDocumentStore store, IDocumentSchema schema, ISerializer serializer, IManagedConnection connection, IQueryParser parser, IIdentityMap identityMap, StoreOptions options) { DocumentStore = store; _schema = schema; _serializer = serializer; _connection = connection; _parser = parser; _identityMap = identityMap; }
public void BuildAndStore(Assembly assembly, DocumentMapping mapping, StoreOptions options) { var provider = DocumentPersistenceBuilder.FromPreBuiltTypes <T>(assembly, mapping); options.Providers.Append(provider); }
/// <summary> /// Add Marten IDocumentStore, IDocumentSession, and IQuerySession service registrations /// to your application using the configured StoreOptions /// </summary> /// <param name="services"></param> /// <param name="options">The Marten configuration for this application</param> /// <returns></returns> public static MartenConfigurationExpression AddMarten(this IServiceCollection services, StoreOptions options) { services.AddSingleton(options); services.AddSingleton <IDocumentStore, DocumentStore>(); // This can be overridden by the expression following services.AddSingleton <ISessionFactory, DefaultSessionFactory>(); services.AddScoped(s => s.GetRequiredService <ISessionFactory>().QuerySession()); services.AddScoped(s => s.GetRequiredService <ISessionFactory>().OpenSession()); return(new MartenConfigurationExpression(services, options)); }
public MartenRegistry(StoreOptions options) { _options = options; }
public IOtherStoreImplementation1113575566(Marten.StoreOptions options) : base(options) { _options = options; }