private void WriteProperty()

in src/Readers/Vipr.Reader.OData.v4/OdcmReader.cs [726:774]


            private void WriteProperty(OdcmClass odcmClass, IEdmProperty property)
            {
                try
                {
                    var odcmType = ResolveType(property.Type);
                    var odcmProperty = new OdcmProperty(property.Name)
                    {
                        Class = odcmClass,
                        IsNullable = property.Type.IsNullable,
                        IsCollection = property.Type.IsCollection(),
                        ContainsTarget =
                            property is IEdmNavigationProperty && ((IEdmNavigationProperty)property).ContainsTarget,
                        IsLink = property is IEdmNavigationProperty,
                        DefaultValue =
                            property is IEdmStructuralProperty ?
                                ((IEdmStructuralProperty)property).DefaultValueString :
                                null
                    };

                    odcmProperty.Projection = new OdcmProjection
                    {
                        Type = odcmType,
                        BackLink = odcmProperty
                    };

                    try
                    {
                        _propertyCapabilitiesCache.Add(odcmProperty, OdcmCapability.DefaultPropertyCapabilities);
                    }
                    catch (InvalidOperationException e)
                    {
                        Logger.Warn("Failed to add property to cache", e);
                    }

                    AddVocabularyAnnotations(odcmProperty, property);

                    odcmClass.Properties.Add(odcmProperty);

                    if (AddCastPropertiesForNavigationProperties)
                    {
                        AddCastPropertiesForNavigationProperty(odcmClass, property, odcmProperty);
                    }

                }
                catch (InvalidOperationException e)
                {
                    Logger.Error("Could not resolve type", e);
                }
            }