Method: Frodo::Schema#referential_constraints_for_entity

Defined in:
lib/frodo/schema.rb

#referential_constraints_for_entity(entity_name) ⇒ Object

Returns a hash for finding the associated read-only value property for a given navigation property



122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/frodo/schema.rb', line 122

def referential_constraints_for_entity(entity_name)
  type_definition = get_type_definition_for_entity_name(entity_name)

  parent_refcons = recurse_on_parent_type(type_definition)

  refcons_to_return = type_definition.xpath('./NavigationProperty[ReferentialConstraint]').map do |nav_property_def|
    [
      nav_property_def.attributes['Name'].value,
      nav_property_def.xpath('./ReferentialConstraint').first.attributes['Property'].value
    ]
  end.to_h
  parent_refcons.merge!(refcons_to_return)
end