/// <summary> /// Define which property is your document id (primary key). Define if this property supports auto-id /// </summary> public EntityBuilder <T> Id <K>(Expression <Func <T, K> > member, bool autoId = true) { return(this.GetMember(member, (p) => { // if contains another _id, remove-it var oldId = _entity.Members.FirstOrDefault(x => x.FieldName == "_id"); if (oldId != null) { oldId.FieldName = _mapper.ResolveFieldName(oldId.MemberName); oldId.AutoId = false; } p.FieldName = "_id"; p.AutoId = autoId; })); }