示例#1
0
        private void CreateLinkElement(XElement entry, string tableName, KeyValuePair <string, object> associatedData)
        {
            if (associatedData.Value == null)
            {
                return;
            }

            var association         = _schema.FindTable(tableName).FindAssociation(associatedData.Key);
            var associatedKeyValues = GetLinkedEntryKeyValues(association.ReferenceTableName, associatedData);

            if (associatedKeyValues != null)
            {
                ODataHelper.AddDataLink(entry, association.ActualName, association.ReferenceTableName, associatedKeyValues);
            }
        }
示例#2
0
        private void CreateLinkElement(XElement entry, string tableName, KeyValuePair <string, object> associatedData)
        {
            if (associatedData.Value == null)
            {
                return;
            }

            var association         = _schema.FindTable(tableName).FindAssociation(associatedData.Key);
            var entryProperties     = GetLinkedEntryProperties(associatedData.Value);
            var associatedKeyNames  = _schema.FindTable(association.ReferenceTableName).GetKeyNames();
            var associatedKeyValues = new object[associatedKeyNames.Count()];

            for (int index = 0; index < associatedKeyNames.Count(); index++)
            {
                bool ok = entryProperties.TryGetValue(associatedKeyNames[index], out associatedKeyValues[index]);
                if (!ok)
                {
                    return;
                }
            }
            ODataHelper.AddDataLink(entry, association.ActualName, association.ReferenceTableName, associatedKeyValues);
        }