You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ability to register indexes, foreign keys, grants, other document mapping needs, etc. for a document type from within the document type class using a static method called ConfigurePersistence(MartenRegistry).
If FubuMVC.Marten sees that in a document type, call it before creating the DocumentStore.
public class DocumentTypeExample
{
public Guid Id { get; set; }
public string FirstName { get; set; }
public int AssigneeId { get; set; }
public int Number { get; set; }
public static void ConfigurePersistence(MartenRegistry registry)
{
registry.MappingFor(this).DatabaseSchemaName = "other";
registry.For(this).ForeignKey<User>(x => x.AssigneeId);
registry.For(this).GinIndexJsonData();
registry.For<User>().Duplicate(x => x.FirstName, configure:idx =>
{
idx.IndexName = "idx_special";
idx.Method = IndexMethod.hash;
});
registry.For(this).Index(x => x.Number, x =>
{
x.Method = IndexMethod.brin;
x.Casing = ComputedIndex.Casings.Lower;
x.IndexName = "mt_my_name";
x.IsConcurrent = true;
x.IsUnique = true;
x.Where = "(data ->> 'Number')::int > 10";
});
}
}
The text was updated successfully, but these errors were encountered:
I went for a public static ConfigureMarten(DocumentMapping) convention on DocumentMapping classes here. If we want to do more discovery via type scanning, I'd rather build that out into FubuMVC.Marten where we can use the more efficient StructureMap type scanning.
Add ability to register indexes, foreign keys, grants, other document mapping needs, etc. for a document type from within the document type class using a static method called
ConfigurePersistence(MartenRegistry)
.If FubuMVC.Marten sees that in a document type, call it before creating the DocumentStore.
The text was updated successfully, but these errors were encountered: