/// <summary> /// Loads the Role entity associated to the current instance (entity.Role property). /// </summary> /// /// <param name="entity"> /// The target entity. /// </param> public void LoadRole(ref VahapYigit.Test.Models.UserRole entity) { if (entity != null) { var options = new SearchOptions(); options.Filters.Add(VahapYigit.Test.Models.Role.ColumnNames.Id, FilterOperator.Equals, entity.IdRole); using (var db = new RoleCrud(base.UserContext)) { var collection = db.Search(ref options); if (collection.Count == 1) { entity.Role = collection[0]; entity.Role.UserRoleCollection.Add(entity); } } } }