Skip to content

Instantly share code, notes, and snippets.

@kianryan
Created December 28, 2013 12:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kianryan/8159246 to your computer and use it in GitHub Desktop.
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