mamift / LinqToXsdCore

LinqToXsd ported to .NET Core (targets .NET Standard 2 for generated code and .NET Core 3.1, .NET 5+ for the code generator CLI tool).
Microsoft Public License
41 stars 15 forks source link

Implement generating a FileInfo property on generated types #4

Open mamift opened 4 years ago

mamift commented 4 years ago

Implement generating a FileInfo property on generated types (the ones that map to global elements or complex types or have static Load() methods).

Also add a new public static Load method; one that accepts a FileInfo parameter, which is also saved as an instance property on the generated type.

Example:

public partial class element {
    public FileInfo FileInfo { get; set; }
    // ...
    public static element Load(FileInfo fileInfo)
    {
        var element = XTypedServices.Load<element>(fileInfo.FullName);
        element.FileInfo = fileInfo;

        return element;
    }
}