本文整理汇总了C#中Marten.Schema.DocumentMapping.AddIndex方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentMapping.AddIndex方法的具体用法?C# DocumentMapping.AddIndex怎么用?C# DocumentMapping.AddIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Marten.Schema.DocumentMapping
的用法示例。
在下文中一共展示了DocumentMapping.AddIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Modify
public override void Modify(DocumentMapping mapping, MemberInfo member)
{
var fkDefinition = mapping.AddForeignKey(member.Name, _referenceType);
mapping.AddIndex(fkDefinition.ColumnName);
}
示例2: Modify
public override void Modify(DocumentMapping mapping, MemberInfo member)
{
var field = mapping.DuplicateField(member.Name, PgType);
var indexDefinition = mapping.AddIndex(field.ColumnName);
indexDefinition.Method = IndexMethod;
if (IndexName.IsNotEmpty())
indexDefinition.IndexName = IndexName;
}
示例3: generate_table_with_indexes
public void generate_table_with_indexes()
{
var mapping = new DocumentMapping(typeof(User));
var i1 = mapping.AddIndex("first_name");
var i2 = mapping.AddIndex("last_name");
var builder = new StringWriter();
SchemaBuilder.WriteSchemaObjects(mapping, null, builder);
var sql = builder.ToString();
sql.ShouldContain(i1.ToDDL());
sql.ShouldContain(i2.ToDDL());
}