Table of Contents

Class EfAnalysisService

Namespace
ProjGraph.Lib.EntityFramework.Application
Assembly
ProjGraph.Lib.EntityFramework.dll

Service responsible for analyzing Entity Framework Core models architectures. Delegates orchestration to specific use cases.

public class EfAnalysisService : IEfAnalysisService
Inheritance
EfAnalysisService
Implements
Inherited Members

Constructors

EfAnalysisService(AnalyzeContextUseCase, DiscoverContextsUseCase, AnalyzeSnapshotUseCase, DiscoverSnapshotsUseCase)

Service responsible for analyzing Entity Framework Core models architectures. Delegates orchestration to specific use cases.

public EfAnalysisService(AnalyzeContextUseCase analyzeContextUseCase, DiscoverContextsUseCase discoverContextsUseCase, AnalyzeSnapshotUseCase analyzeSnapshotUseCase, DiscoverSnapshotsUseCase discoverSnapshotsUseCase)

Parameters

analyzeContextUseCase AnalyzeContextUseCase

The use case for analyzing DbContext classes.

discoverContextsUseCase DiscoverContextsUseCase

The use case for discovering DbContext classes.

analyzeSnapshotUseCase AnalyzeSnapshotUseCase

The use case for analyzing ModelSnapshot classes.

discoverSnapshotsUseCase DiscoverSnapshotsUseCase

The use case for discovering ModelSnapshot classes.

Methods

AnalyzeContextAsync(string, string?)

Analyzes the specified Entity Framework context and retrieves its model.

public Task<EfModel> AnalyzeContextAsync(string path, string? contextName = null)

Parameters

path string

The file path to the project or solution containing the context.

contextName string

The name of the context to analyze. If null, the default context is analyzed.

Returns

Task<EfModel>

A task that represents the asynchronous operation. The task result contains the analyzed Entity Framework model.

AnalyzeSnapshotAsync(string, string?)

Analyzes the specified Entity Framework model snapshot and retrieves its model.

public Task<EfModel> AnalyzeSnapshotAsync(string path, string? snapshotName = null)

Parameters

path string

The file path to the C# file containing the model snapshot.

snapshotName string

The name of the snapshot to analyze. If null, the first snapshot found in the file is analyzed.

Returns

Task<EfModel>

A task that represents the asynchronous operation. The task result contains the analyzed Entity Framework model.

DiscoverContextsAsync(string)

Discovers all Entity Framework contexts in the specified path.

public Task<List<string>> DiscoverContextsAsync(string path)

Parameters

path string

The file path to search for Entity Framework contexts.

Returns

Task<List<string>>

A task that represents the asynchronous operation. The task result contains a list of discovered context names.

DiscoverSnapshotsAsync(string)

Discovers all Entity Framework model snapshots in the specified path.

public Task<List<string>> DiscoverSnapshotsAsync(string path)

Parameters

path string

The file path to search for Entity Framework model snapshots.

Returns

Task<List<string>>

A task that represents the asynchronous operation. The task result contains a list of discovered snapshot names.