コード例 #1
0
        /// <inheritdoc />
        public bool TryGetPropertyValue(string propertyName, out object value)
        {
            // look into the container first to see if it has that property. container would have it
            // if the property was expanded.
            if (Container != null)
            {
                _containerDict = _containerDict ?? Container.ToDictionary(DefaultPropertyMapper, includeAutoSelected: true);
                if (_containerDict.TryGetValue(propertyName, out value))
                {
                    return(true);
                }
            }

            // fall back to the instance.
            if (Instance != null)
            {
                var type     = Instance.GetType();
                var edmodel  = ModelContainer.GetModel(type);
                var edrefect = edmodel.GetEdmTypeReference(type);

                _typedEdmEntityObject = _typedEdmEntityObject ??
                                        new TypedEdmEntityObject(Instance, /*GetEdmType()*/ edrefect as IEdmEntityTypeReference, edmodel /*GetModel()*/);

                return(_typedEdmEntityObject.TryGetPropertyValue(propertyName, out value));
            }

            value = null;
            return(false);
        }
コード例 #2
0
ファイル: SelectExpandWrapper.cs プロジェクト: maxr96/odata
        private IEdmModel GetModel()
        {
            Contract.Assert(ModelID != null);

            return(ModelContainer.GetModel(ModelID));
        }