Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EDMX Element Checker
require 'rexml/document'
edmx = File.read(ARGV.first)
doc = REXML::Document.new(edmx)
mapped = []
constrained = []
doc.elements.each('edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/Schema/Association') do |ele|
if ele.get_elements('ReferentialConstraint').any?
constrained.push ele.attribute("Name")
else
mapped.push ele.attribute("Name")
end
end
puts "Mapped Elements"
puts "---------------"
puts mapped
puts
puts "Constrained Elements"
puts "--------------------"
puts constrained
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment