Constantin Ziesche | 0821550 | 2020-09-21 19:08:32 +0200 | [diff] [blame^] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2020 Robert Bosch GmbH |
| 3 | * Author: Constantin Ziesche (constantin.ziesche@bosch.com) |
| 4 | * |
| 5 | * This program and the accompanying materials are made available under the |
| 6 | * terms of the Eclipse Public License 2.0 which is available at |
| 7 | * http://www.eclipse.org/legal/epl-2.0 |
| 8 | * |
| 9 | * SPDX-License-Identifier: EPL-2.0 |
| 10 | *******************************************************************************/ |
| 11 | using BaSyx.Models.Core.AssetAdministrationShell.Identification; |
| 12 | using System; |
| 13 | using System.Collections.Generic; |
| 14 | using System.Linq; |
| 15 | using System.Linq.Expressions; |
| 16 | |
| 17 | namespace BaSyx.Models.Core.Common |
| 18 | { |
| 19 | public class QueryableElementContainer<TElement> : ElementContainer<TElement>, IQueryableElementContainer<TElement> where TElement : IReferable, IModelElement |
| 20 | { |
| 21 | private readonly IQueryable<TElement> _queryable; |
| 22 | public QueryableElementContainer(IReferable parent, IEnumerable<TElement> list) : base(parent, list) |
| 23 | { |
| 24 | _queryable = list.AsQueryable(); |
| 25 | } |
| 26 | |
| 27 | public Type ElementType => _queryable.ElementType; |
| 28 | |
| 29 | public Expression Expression => _queryable.Expression; |
| 30 | |
| 31 | public IQueryProvider Provider => _queryable.Provider; |
| 32 | |
| 33 | IEnumerator<TElement> IEnumerable<TElement>.GetEnumerator() |
| 34 | { |
| 35 | return _queryable.GetEnumerator(); |
| 36 | } |
| 37 | } |
| 38 | } |