class OData::Association
Internal class used to represent object associations
Attributes
from_role[R]
name[R]
namespace[R]
relationship[R]
to_role[R]
Public Class Methods
new(nav_prop_element, edmx)
click to toggle source
# File lib/ruby_odata/association.rb, line 7 def initialize(nav_prop_element, edmx) @edmx = edmx # Get the edm namespace because it varies by version edm_ns = @edmx.xpath("edmx:Edmx/edmx:DataServices/*", "edmx" => "http://schemas.microsoft.com/ado/2007/06/edmx").first.namespaces['xmlns'].to_s @edmx_namespaces = { "edmx" => "http://schemas.microsoft.com/ado/2007/06/edmx", "edm" => edm_ns } parse_nav_prop(nav_prop_element) end
Private Instance Methods
role_hash(association_name, role_name)
click to toggle source
# File lib/ruby_odata/association.rb, line 27 def role_hash(association_name, role_name) # Find the end role based on the assocation name role_xpath = "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='#{@namespace}']/edm:Association[@Name='#{association_name}']/edm:End[@Role='#{role_name}']" role_element = @edmx.xpath(role_xpath, @edmx_namespaces).first { role_name => { :edmx_type => "#{role_element['Type']}", :multiplicity => "#{role_element['Multiplicity']}" }} end