Click or drag to resize

LiteRepositoryEnsureIndexT, K(String, ExpressionFuncT, K, Boolean, String) Method

Create a new permanent index in all documents inside this collections if index not exists already.

Namespace: Internal.LiteDB
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntax
C#
public bool EnsureIndex<T, K>(
	string name,
	Expression<Func<T, K>> keySelector,
	bool unique = false,
	string collectionName = null
)

Parameters

name  String
Index name - unique name for this collection
keySelector  ExpressionFuncT, K
LinqExpression to be converted into BsonExpression to be indexed
unique  Boolean  (Optional)
Create a unique keys index?
collectionName  String  (Optional)
Collection Name

Type Parameters

T
K

Return Value

Boolean

Implements

ILiteRepositoryEnsureIndexT, K(String, ExpressionFuncT, K, Boolean, String)
See Also