private ColumnMapCollection GetColumns(IEnumerable <string> entitiesToLoad) { // If QueryToGraph<T> and no child load entities are specified, load all children bool useAltNames = _isFromView || _isGraph || _isJoin; bool loadAllChildren = useAltNames && entitiesToLoad == null; // If Query<T> if (!useAltNames) { return(MapRepository.Instance.GetColumns(typeof(T))); } ColumnMapCollection columns = new ColumnMapCollection(); Type baseEntityType = typeof(T); EntityGraph graph = new EntityGraph(baseEntityType, null); foreach (var lvl in graph) { if (loadAllChildren || lvl.IsRoot || entitiesToLoad.Contains(lvl.Member.Name)) { columns.AddRange(lvl.Columns); } } return(columns); }
public virtual InsertQueryBuilder <T> ColumnsExcluding(params string[] properties) { _columnsToInsert = new ColumnMapCollection(); _columnsToInsert.AddRange(_mappings); foreach (string propertyName in properties) { _columnsToInsert.RemoveAll(c => c.FieldName == propertyName); } return(this); }