I added all the schemas to the project, right clicked "Properties" and set them all to Embedded Resources.
However it could refer to a URL, or some custom scheme.
On this project, it's a (light) requirement that we use the specification schemas unchanged. So, I pass in a custom resolver that will find the correct schema given the URI (the value in the schema Location attribute) and return it, in this example, as a stream.
Here we just grab the relative filename from out of the file:/// URI that we're passed into Get Entity each time a schema Location needs to be resolved. I wrap the whole thing in a factory method and cache the compiled Xml Schema Collection so we don't load and compile this more than once. I've seen folks build Assembly schemas like assembly:/// and embed stuff in the schemas, but eh, who has the time.
To make this task semi automated I need to do this inside TSQL function.
To make validation I have to set value to XML and if it is not valid I will receive an error.
The Validation Event Handler will call you back if there's any trouble. XSD files - 64 of them - that represent a single specification.