private void WriteProperty()

in src/Readers/Vipr.Reader.OData.v4/OdcmReader.cs [608:644]


            private void WriteProperty(OdcmClass odcmClass, IEdmSingleton singleton)
            {
                try
                {
                    // Get and set the NavigationPropertyBindings on the OdcmModel that we'll use in the generator.
                    var navPropBindings = GetNavigationPropertyBindings(singleton);
                    var odcmProperty = new OdcmSingleton(singleton.Name, navPropBindings)
                    {
                        Class = odcmClass,
                        IsLink = true
                    };

                    var odcmType = ResolveType(singleton.EntityType().Name, singleton.EntityType().Namespace);
                    odcmProperty.Projection = new OdcmProjection
                    {
                        Type = odcmType,
                        BackLink = odcmProperty
                    };

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

                    AddVocabularyAnnotations(odcmProperty, singleton);

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