Created
December 28, 2013 12:56
-
-
Save kianryan/8159246 to your computer and use it in GitHub Desktop.
EDMX Element Checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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