Closed jhancock-taxa closed 4 months ago
Sorry but LinqToXsd does not support those. It was originally started as a strongly-typed wrapper API around the Linq to XML API (think XDocument, XElement etc), and it's evolved that way. Adding that in is definitely possible though, but the code generator does not generate these attributes at the moment.
If System.Component.DataAnnotations are a hard requirement, I recommend using XmlSchemaClassGenerator - it generates code that's very close to what old-school xsd.exe gives you and also supports emitting DataAnnotations. LinqToXSD has its own validation mechanism that does not use DataAnnotations (it generates its own TypeValidator classes for validation).
I searched everywhere and I couldn't find any documentation on how to enable DataAnnotations being generated on the file. It see that it's generating XML Documentation but not generating DataAnnotations.
I was expecting like the xsd.exe to see MaxLength, RegularExpression, Description attributes on everything.
Is there a way to turn these on?