IEntityFrameworkService.GetModelMetadata(String, ModelType, String) Method

Definition

Gets the EF metadata for given context and model. Method takes in full type name of context and if there is no context with that name, attempts to create one. When creating a context, the method also tries to modify Startup code to register the new context through DI. When the given context is available but there is no DbSet property of given model type context will be edited to add the property. The method throws exceptions if there are any errors running EF code to get the EF metadata. And no changes are written to disk. When the method successfully returned, it's guranteed to have ModelMetadata present in the return value. Before returning all the code edits are persisted to disk.

public:
 System::Threading::Tasks::Task<Microsoft::VisualStudio::Web::CodeGeneration::EntityFrameworkCore::ContextProcessingResult ^> ^ GetModelMetadata(System::String ^ dbContextFullTypeName, Microsoft::VisualStudio::Web::CodeGeneration::ModelType ^ modelTypeName, System::String ^ areaName);
public System.Threading.Tasks.Task<Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.ContextProcessingResult> GetModelMetadata (string dbContextFullTypeName, Microsoft.VisualStudio.Web.CodeGeneration.ModelType modelTypeName, string areaName);
abstract member GetModelMetadata : string * Microsoft.VisualStudio.Web.CodeGeneration.ModelType * string -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.ContextProcessingResult>
Public Function GetModelMetadata (dbContextFullTypeName As String, modelTypeName As ModelType, areaName As String) As Task(Of ContextProcessingResult)

Parameters

dbContextFullTypeName
String

Full name (including namespace) of the context class.

modelTypeName
ModelType

Model type for which the EF metadata has to be returned.

areaName
String

Name of the area on which scaffolding is being run. Used for generating path for new DbContext.

Returns

Task<ContextProcessingResult>

Returns ContextProcessingResult.

Applies to