We would like to add only .EDMX files without corresponding .tt files for context and entities. There is multiple reasons for this, but long story short - we would like to be able to have .EDMX and be able to refresh it from DB when needed.
Currently if I delete .tt files every time I "Update from DB" it will regenerate .tt files and entitites which we don't need.
If it's enough to have only the
.edmx
with two empty.tt
files you can do that:Custom Tool
value on each.tt
file and on the.edmx
file.tt
files if you want.diagram
fileAfter this steps, you can update your
.edmx
file and nothing happens.You can try this.
.tt
files under your.edmx
file.EF 6.x DbContext Generator
It will generate new
.tt
files. In these.tt
files you can specify.edmx
file path.Run these
.tt
files to generateModel1
classes.Disable
.tt
files (Don't delete content as you will need it if you want to update your entities later. Usually they generate new files when you save them)Update your
.edmx
(add/remove tables)..tt
files under edmx.tt
files.I tried this and "Update Model From Database" didn't generate new .tt files. So hopefully your problem will be solved.
I'm not sure I understand fully, but I simply delete the pair of t4/tt files that are included with the model and the previously generated class files. They don't come back for EF6.
Then I delete them and I update model from database:
and they don't come back:
This is from EF 6.2:
Are you sure you're not dealing with some source control issue?