Skip to content

Codebase for an MSBuild based version of the Entity Framework 6 Power Tools Generate Views command

License

Notifications You must be signed in to change notification settings

CZEMacLeod/C3D.MSBuild.Tools.EF6.GenerateViews

Repository files navigation

C3D.MSBuild.Tools.EF6.GenerateViews

An MSBuild based implementation of the Entity Framework 6 Power Tools Community Edition Generate Views command.

Build Status NuGet package NuGet downloads

The samples folder shows the use of the package with NETFramework and NETCore (.Net 5)

This is for EntityFramework 6 only - not EFCore

An example of how to get the EDMX file from your context file is given in the program main. It will write the EDMX for the context to the executable folder. You can copy this into your application directory. Ensure it is not set to any build action or have any custom tool attached.

Set the Build Action to EntityView

Set the Custom Tool Namespace to match your database context's namespace.

On build, the Views will be generated in the obj folder and automatically included in the build.

If you are using Code-First migrations, you can add the following to automatically generate views based on the last edmx file in the migrations folder.

  <ItemGroup>
    <EntityView Include="Migrations\**\*.edmx">
      <CustomToolNamespace>MyApplication.Models.DAL</CustomToolNamespace>
    </EntityView>
  </ItemGroup>

Known Properties

EntityFramework6GenerateViewsOutputDir - Defaults to $(IntermediateOutputPath)\EntityViews

Known Items

  • EntityView - One or more edmx files used to generate the Views. Only the latest (alphabetically last) file is used.
    • CustomToolNamespace - Item Metadata of the EntityView item used to determine the namespace of the DBContext. The DBContext name itself is determined from the EDMX file.

About

Codebase for an MSBuild based version of the Entity Framework 6 Power Tools Generate Views command

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages