Click or drag to resize

LiteRepository Class

The LiteDB repository pattern. A simple way to access your documents in a single class with fluent query api
Inheritance Hierarchy
SystemObject
  Internal.LiteDBLiteRepository

Namespace: Internal.LiteDB
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntax
C#
public class LiteRepository : ILiteRepository, 
	IDisposable

The LiteRepository type exposes the following members.

Constructors
 NameDescription
Public methodLiteRepository(ILiteDatabase) Starts LiteDB database an existing Database instance
Public methodLiteRepository(ConnectionString, BsonMapper) Starts LiteDB database using a connection string for file system database
Public methodLiteRepository(String, BsonMapper) Starts LiteDB database using a connection string for file system database
Public methodLiteRepository(Stream, BsonMapper, Stream) Starts LiteDB database using a Stream disk
Top
Properties
 NameDescription
Public propertyDatabase Get database instance
Top
Methods
 NameDescription
Public methodDeleteT Delete entity based on _id key
Public methodDeleteManyT(BsonExpression, String) Delete entity based on Query
Public methodDeleteManyT(ExpressionFuncT, Boolean, String) Delete entity based on predicate filter expression
Public methodDisposeReleases all resources used by the LiteRepository
Protected methodDispose(Boolean)Releases the unmanaged resources used by the LiteRepository and optionally releases the managed resources
Public methodEnsureIndexT(BsonExpression, Boolean, String) Create a new permanent index in all documents inside this collections if index not exists already. Returns true if index was created or false if already exits
Public methodEnsureIndexT(String, BsonExpression, Boolean, String) Create a new permanent index in all documents inside this collections if index not exists already. Returns true if index was created or false if already exits
Public methodEnsureIndexT, K(ExpressionFuncT, K, Boolean, String) Create a new permanent index in all documents inside this collections if index not exists already.
Public methodEnsureIndexT, K(String, ExpressionFuncT, K, Boolean, String) Create a new permanent index in all documents inside this collections if index not exists already.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodFetchT(BsonExpression, String) Execute Query[T].Where(predicate).ToList();
Public methodFetchT(ExpressionFuncT, Boolean, String) Execute Query[T].Where(predicate).ToList();
Protected methodFinalize
(Overrides ObjectFinalize)
Public methodFirstT(BsonExpression, String) Execute Query[T].Where(predicate).First();
Public methodFirstT(ExpressionFuncT, Boolean, String) Execute Query[T].Where(predicate).First();
Public methodFirstOrDefaultT(BsonExpression, String) Execute Query[T].Where(predicate).FirstOrDefault();
Public methodFirstOrDefaultT(ExpressionFuncT, Boolean, String) Execute Query[T].Where(predicate).FirstOrDefault();
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodInsertT(IEnumerableT, String) Insert an array of new documents into collection. Document Id must be a new value in collection. Can be set buffer size to commit at each N documents
Public methodInsertT(T, String) Insert a new document into collection. Document Id must be a new value in collection - Returns document Id
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodQueryT Returns new instance of LiteQueryable that provides all method to query any entity inside collection. Use fluent API to apply filter/includes an than run any execute command, like ToList() or First()
Public methodSingleT(BsonExpression, String) Execute Query[T].Where(predicate).Single();
Public methodSingleT(ExpressionFuncT, Boolean, String) Execute Query[T].Where(predicate).Single();
Public methodSingleByIdT Search for a single instance of T by Id. Shortcut from Query.SingleById
Public methodSingleOrDefaultT(BsonExpression, String) Execute Query[T].Where(predicate).SingleOrDefault();
Public methodSingleOrDefaultT(ExpressionFuncT, Boolean, String) Execute Query[T].Where(predicate).SingleOrDefault();
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodUpdateT(IEnumerableT, String) Update all documents
Public methodUpdateT(T, String) Update a document into collection. Returns false if not found document in collection
Public methodUpsertT(IEnumerableT, String) Insert or Update all documents based on _id key. Returns entity count that was inserted
Public methodUpsertT(T, String) Insert or Update a document based on _id key. Returns true if insert entity or false if update entity
Top
Extension Methods
 NameDescription
Public Extension MethodMethodInvoke Calls the object method by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGet Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGetT Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertySet Sets the value of the object property by name.
(Defined by ObjectEx)
Top
See Also