EdmxLoader

Loads and parses EDMX files, extracting Entity Data Model components and EasyAF extensions.

Syntax

public class EdmxLoader

Inheritance

Constructors

EdmxLoader

public EdmxLoader()
Initializes a new instance of the class.

EdmxLoader

public EdmxLoader(string filePath)
Initializes a new instance of the class with the specified file path.

Parameters

  • filePath string: The path to the EDMX file to load.

Exceptions

  • [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception): Thrown when the file path does not exist or is not an EDMX file.

Properties

CsdlElement

public XElement CsdlElement { get; }
Gets or sets the CSDL (Conceptual Schema Definition Language) XML element.

Returns

XElement

EdmItems

public EdmItemCollection EdmItems { get; }
Gets or sets the Entity Data Model item collection containing conceptual model metadata.

Returns

EdmItemCollection

EdmxSchemaErrors

public List<CompilerError> EdmxSchemaErrors { get; }
Gets or sets the collection of EDMX schema errors encountered during loading.

Returns

List<CompilerError>

Entities

public List<EntityComposition> Entities { get; }
Gets or sets the collection of entity compositions extracted from the model.

Returns

List<EntityComposition>

EntityContainer

public EntityContainer EntityContainer { get; }
Gets or sets the entity container from the conceptual model.

Returns

EntityContainer

EntitySets

public List<EntitySet> EntitySets { get; }
Gets the collection of entity sets from the entity container.

Returns

List<EntitySet>

FilePath

public string FilePath { get; }
Gets or sets the file path of the loaded EDMX file.

Returns

string

IsEFCore

public bool IsEFCore { get; }
Gets a value indicating whether the model is using Entity Framework Core.

Returns

bool

Mappings

public StorageMappingItemCollection Mappings { get; }
Gets or sets the storage mapping item collection containing C-S mapping metadata.

Returns

StorageMappingItemCollection

ModelNamespace

public string ModelNamespace { get; set; }
Gets or sets the namespace of the conceptual model.

Returns

string

MslElement

public XElement MslElement { get; }
Gets or sets the MSL (Mapping Specification Language) XML element.

Returns

XElement

OnModelCreatingMethod

public string OnModelCreatingMethod { get; }
Gets or sets the complete OnModelCreating method extracted from EasyAF extensions.

Returns

string The complete C# OnModelCreating method including signature and braces as a string. Returns an empty string if no OnModelCreating method is found in the EDMX file.

SsdlElement

public XElement SsdlElement { get; }
Gets or sets the SSDL (Store Schema Definition Language) XML element.

Returns

XElement

StoreItems

public StoreItemCollection StoreItems { get; }
Gets or sets the store item collection containing storage model metadata.

Returns

StoreItemCollection

Methods

Load

public void Load(bool fixProvider = true)
Loads and parses the EDMX file from the file path specified in the constructor.

Parameters

  • fixProvider bool: Whether to fix the provider attribute to use System.Data.SqlClient.

Load

public void Load(string content, bool fixProvider = true)
Loads and parses the EDMX content from the specified string.

Parameters

  • content string: The EDMX XML content to parse.
  • fixProvider bool: Whether to fix the provider attribute to use System.Data.SqlClient.