LiteDB
LiteDB copied to clipboard
[Question] : Better approach for creating index when using repository pattern?
Hi,
I am performing an Upsert operation using the Repository pattern, is there a better approach for creating index then the one given below (may be using the fluent API?)
using (var db = new LiteRepository(dbSource))
{
db.Database.GetCollection<UserDTO>("Users").EnsureIndex(x => x.Email, true);
db.Upsert(User, "Users");
}
Hi @jeshwel, there is not other way to create indexes in Repository class.... I will think about adding this... thanks!
Thanks @mbdavid , if you can add this as an attribute like [BsonRef] or as part of the Fluent mapper Api it would be cool :)
Hi @mbdavid, is this possible yet? Or any plans to do this in the future?
I find the current way of setting up indexes quite un-intuitive.
I think it would be great to be able to define indexes through attributes or in a fluent configuration way, instead of always calling EnsureIndex.
@mbdavid maybe can Add A Attribute to do that.