Entity Framework - only edmx without templates The Next CEO of Stack OverflowSplitting EDMX ModelEntity Framework vs LINQ to SQLHow to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Interface defining a constructor signature?SqlException from Entity Framework - New transaction is not allowed because there are other threads running in the sessionEntity Framework TimeoutsEntity Framework 5 stopped running T4 templates files on saveEntity Framework 5 Updating a RecordStored Procedures and updating EDMXEntity Framework refresh didn't update the Table properly
Compensation for working overtime on Saturdays
Do I need to write [sic] when including a quotation with a number less than 10 that isn't written out?
What happens if you break a law in another country outside of that country?
How dangerous is XSS
Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?
Can Sri Krishna be called 'a person'?
Calculate the Mean mean of two numbers
Oldie but Goldie
Can you teleport closer to a creature you are Frightened of?
Can I hook these wires up to find the connection to a dead outlet?
How can the PCs determine if an item is a phylactery?
What difference does it make matching a word with/without a trailing whitespace?
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?
Incomplete cube
How did scripture get the name bible?
Mathematica command that allows it to read my intentions
Arrows in tikz Markov chain diagram overlap
Why do we say “un seul M” and not “une seule M” even though M is a “consonne”?
Is the 21st century's idea of "freedom of speech" based on precedent?
Are British MPs missing the point, with these 'Indicative Votes'?
How to show a landlord what we have in savings?
Why can't we say "I have been having a dog"?
How to pronounce fünf in 45
Entity Framework - only edmx without templates
The Next CEO of Stack OverflowSplitting EDMX ModelEntity Framework vs LINQ to SQLHow to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Interface defining a constructor signature?SqlException from Entity Framework - New transaction is not allowed because there are other threads running in the sessionEntity Framework TimeoutsEntity Framework 5 stopped running T4 templates files on saveEntity Framework 5 Updating a RecordStored Procedures and updating EDMXEntity Framework refresh didn't update the Table properly
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.
c# .net entity-framework-6
|
show 6 more comments
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.
c# .net entity-framework-6
Have you tried keeping the .tt files but deleting their content?
– yv989c
Mar 21 at 20:36
Yes. And it would be "kind of" ok but code becomes somewhat "dirty" with extra empty files under each EDMX ModelA.context.tt, ModelA.Context.cs, ModelA.tt, ModelA.cs.
– katit
Mar 21 at 20:53
Just curious: Whats the goal, behind having an EDMX, but no T4 templates, and therefore no Context and Entities? If it's database visualisation, aren't there better tools out there? And why not simple create a new project for the visualization?
– Christian Gollhardt
Mar 21 at 21:22
It's a long story, but basically T4s don't do what we need. We need multi-files generated for different purposes. So, we will have contexts and entities but going to handle generation in our own code (based off EDMX) without using T4s. We can make T4s work I assume but with complexity of what we do it seems that going our own generator will be more maintainable
– katit
Mar 21 at 22:13
I am not exactly sure, but couldn't you make you own generator a Custom Tool (its a property of the edmx) for the edmx? Take a look here, not that I have done that.
– Christian Gollhardt
Mar 21 at 23:39
|
show 6 more comments
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.
c# .net entity-framework-6
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.
c# .net entity-framework-6
c# .net entity-framework-6
asked Mar 21 at 20:05
katitkatit
7,24129105219
7,24129105219
Have you tried keeping the .tt files but deleting their content?
– yv989c
Mar 21 at 20:36
Yes. And it would be "kind of" ok but code becomes somewhat "dirty" with extra empty files under each EDMX ModelA.context.tt, ModelA.Context.cs, ModelA.tt, ModelA.cs.
– katit
Mar 21 at 20:53
Just curious: Whats the goal, behind having an EDMX, but no T4 templates, and therefore no Context and Entities? If it's database visualisation, aren't there better tools out there? And why not simple create a new project for the visualization?
– Christian Gollhardt
Mar 21 at 21:22
It's a long story, but basically T4s don't do what we need. We need multi-files generated for different purposes. So, we will have contexts and entities but going to handle generation in our own code (based off EDMX) without using T4s. We can make T4s work I assume but with complexity of what we do it seems that going our own generator will be more maintainable
– katit
Mar 21 at 22:13
I am not exactly sure, but couldn't you make you own generator a Custom Tool (its a property of the edmx) for the edmx? Take a look here, not that I have done that.
– Christian Gollhardt
Mar 21 at 23:39
|
show 6 more comments
Have you tried keeping the .tt files but deleting their content?
– yv989c
Mar 21 at 20:36
Yes. And it would be "kind of" ok but code becomes somewhat "dirty" with extra empty files under each EDMX ModelA.context.tt, ModelA.Context.cs, ModelA.tt, ModelA.cs.
– katit
Mar 21 at 20:53
Just curious: Whats the goal, behind having an EDMX, but no T4 templates, and therefore no Context and Entities? If it's database visualisation, aren't there better tools out there? And why not simple create a new project for the visualization?
– Christian Gollhardt
Mar 21 at 21:22
It's a long story, but basically T4s don't do what we need. We need multi-files generated for different purposes. So, we will have contexts and entities but going to handle generation in our own code (based off EDMX) without using T4s. We can make T4s work I assume but with complexity of what we do it seems that going our own generator will be more maintainable
– katit
Mar 21 at 22:13
I am not exactly sure, but couldn't you make you own generator a Custom Tool (its a property of the edmx) for the edmx? Take a look here, not that I have done that.
– Christian Gollhardt
Mar 21 at 23:39
Have you tried keeping the .tt files but deleting their content?
– yv989c
Mar 21 at 20:36
Have you tried keeping the .tt files but deleting their content?
– yv989c
Mar 21 at 20:36
Yes. And it would be "kind of" ok but code becomes somewhat "dirty" with extra empty files under each EDMX ModelA.context.tt, ModelA.Context.cs, ModelA.tt, ModelA.cs.
– katit
Mar 21 at 20:53
Yes. And it would be "kind of" ok but code becomes somewhat "dirty" with extra empty files under each EDMX ModelA.context.tt, ModelA.Context.cs, ModelA.tt, ModelA.cs.
– katit
Mar 21 at 20:53
Just curious: Whats the goal, behind having an EDMX, but no T4 templates, and therefore no Context and Entities? If it's database visualisation, aren't there better tools out there? And why not simple create a new project for the visualization?
– Christian Gollhardt
Mar 21 at 21:22
Just curious: Whats the goal, behind having an EDMX, but no T4 templates, and therefore no Context and Entities? If it's database visualisation, aren't there better tools out there? And why not simple create a new project for the visualization?
– Christian Gollhardt
Mar 21 at 21:22
It's a long story, but basically T4s don't do what we need. We need multi-files generated for different purposes. So, we will have contexts and entities but going to handle generation in our own code (based off EDMX) without using T4s. We can make T4s work I assume but with complexity of what we do it seems that going our own generator will be more maintainable
– katit
Mar 21 at 22:13
It's a long story, but basically T4s don't do what we need. We need multi-files generated for different purposes. So, we will have contexts and entities but going to handle generation in our own code (based off EDMX) without using T4s. We can make T4s work I assume but with complexity of what we do it seems that going our own generator will be more maintainable
– katit
Mar 21 at 22:13
I am not exactly sure, but couldn't you make you own generator a Custom Tool (its a property of the edmx) for the edmx? Take a look here, not that I have done that.
– Christian Gollhardt
Mar 21 at 23:39
I am not exactly sure, but couldn't you make you own generator a Custom Tool (its a property of the edmx) for the edmx? Take a look here, not that I have done that.
– Christian Gollhardt
Mar 21 at 23:39
|
show 6 more comments
3 Answers
3
active
oldest
votes
If it's enough to have only the .edmx
with two empty .tt
files you can do that:
- Add the Entity Data Model (EF Designer from database)
- Cancel initial execution of the tools
- Empty
Custom Tool
value on each.tt
file and on the.edmx
file - Delete contents of the
.tt
files if you want - Delete
.diagram
file
After this steps, you can update your .edmx
file and nothing happens.
Looks like this is the best answer so far. You can ALSO delete .context.tt and it will "comply" with it. So, just Model1.tt required
– katit
Mar 25 at 15:52
The interesting part is, if I disable "Transform Related Text Templates On Save" after this steps, then I can delete all.tt
files... Can you reproduce this too?
– kapsiR
Mar 25 at 15:59
@katit It seems that it is enough to just remove theCustom Tool
from the.edmx
file
– kapsiR
Mar 25 at 16:14
Nope. If I remove Model1.tt - it will recreate both .tt files on "update". Yes, I have "Transform.." disabled
– katit
Mar 25 at 16:23
add a comment |
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?
We dont have Model1.Designer.cs and we don't have Model1.edmx.diagram. When we do "Update Model from Database" they come back. It's EF6.2
– katit
Mar 25 at 15:13
Using 6.2 also, the designer.cs file will get created but it's just got a comment:T4 code generation is enabled for model 'C:sourcereposConsoleApp2DataModel1.edmx'...
Try adding a new model, repeat my steps to see...
– reckface
Mar 25 at 15:19
Just did that and it's restoring tts. I don't think it's source control because I can modify tts and then delete them after saving and it would restore with fresh unmodified tts. Also, when I do model I chose not to save connection string in .config and do the same on "update"
– katit
Mar 25 at 15:25
@katit it's actually impossible for .tt files to be regenerated. There's no mechanism in Visual Studio to recreate .tt files that are associated directly with the model. Tried this with EF5,even changing theCode Generation Strategy
from T4, just creates db context
– reckface
Mar 25 at 16:50
Not sure what do you mean impossible. According to other posters and other answers - people are seeing same behaviour. If you delete .tt files and leave just .edmx - every time you "update" - VS/EF tool will recreate both .tt files.
– katit
Mar 25 at 16:52
|
show 2 more comments
You can try this.
- Delete
.tt
files under your.edmx
file. - Project -> Add -> New Item ->
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).- This will not generate new
.tt
files under edmx - And it will not update your entity classes.
- And if you want to update your entity classes, then run
.tt
files.
I tried this and "Update Model From Database" didn't generate new .tt files. So hopefully your problem will be solved.
It would be kind of workaround, however we have multiple .edmx files and having separate templates for each will be messy
– katit
Mar 25 at 15:54
We have this solution in our workspace. Usually we have all edmx in one project (lets say DataLayer) and all entities in another project (Entities). This makes a separation and allows flexibility. Also we have modified our.tt
to generate some custom code (like interfaces for classes).
– fhnaseer
Mar 25 at 16:03
@katit but with this solution, the tt files will now generate any .cs files so your problem will be solved. In fact, I think it's pretty difficult for .tt files to be autogenerated.
– reckface
Mar 25 at 16:04
The good thing is that you don't delete anything. You just keep them separate and update each component whenever you want.
– fhnaseer
Mar 25 at 16:06
add a comment |
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288485%2fentity-framework-only-edmx-without-templates%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
If it's enough to have only the .edmx
with two empty .tt
files you can do that:
- Add the Entity Data Model (EF Designer from database)
- Cancel initial execution of the tools
- Empty
Custom Tool
value on each.tt
file and on the.edmx
file - Delete contents of the
.tt
files if you want - Delete
.diagram
file
After this steps, you can update your .edmx
file and nothing happens.
Looks like this is the best answer so far. You can ALSO delete .context.tt and it will "comply" with it. So, just Model1.tt required
– katit
Mar 25 at 15:52
The interesting part is, if I disable "Transform Related Text Templates On Save" after this steps, then I can delete all.tt
files... Can you reproduce this too?
– kapsiR
Mar 25 at 15:59
@katit It seems that it is enough to just remove theCustom Tool
from the.edmx
file
– kapsiR
Mar 25 at 16:14
Nope. If I remove Model1.tt - it will recreate both .tt files on "update". Yes, I have "Transform.." disabled
– katit
Mar 25 at 16:23
add a comment |
If it's enough to have only the .edmx
with two empty .tt
files you can do that:
- Add the Entity Data Model (EF Designer from database)
- Cancel initial execution of the tools
- Empty
Custom Tool
value on each.tt
file and on the.edmx
file - Delete contents of the
.tt
files if you want - Delete
.diagram
file
After this steps, you can update your .edmx
file and nothing happens.
Looks like this is the best answer so far. You can ALSO delete .context.tt and it will "comply" with it. So, just Model1.tt required
– katit
Mar 25 at 15:52
The interesting part is, if I disable "Transform Related Text Templates On Save" after this steps, then I can delete all.tt
files... Can you reproduce this too?
– kapsiR
Mar 25 at 15:59
@katit It seems that it is enough to just remove theCustom Tool
from the.edmx
file
– kapsiR
Mar 25 at 16:14
Nope. If I remove Model1.tt - it will recreate both .tt files on "update". Yes, I have "Transform.." disabled
– katit
Mar 25 at 16:23
add a comment |
If it's enough to have only the .edmx
with two empty .tt
files you can do that:
- Add the Entity Data Model (EF Designer from database)
- Cancel initial execution of the tools
- Empty
Custom Tool
value on each.tt
file and on the.edmx
file - Delete contents of the
.tt
files if you want - Delete
.diagram
file
After this steps, you can update your .edmx
file and nothing happens.
If it's enough to have only the .edmx
with two empty .tt
files you can do that:
- Add the Entity Data Model (EF Designer from database)
- Cancel initial execution of the tools
- Empty
Custom Tool
value on each.tt
file and on the.edmx
file - Delete contents of the
.tt
files if you want - Delete
.diagram
file
After this steps, you can update your .edmx
file and nothing happens.
answered Mar 25 at 15:43
kapsiRkapsiR
9371018
9371018
Looks like this is the best answer so far. You can ALSO delete .context.tt and it will "comply" with it. So, just Model1.tt required
– katit
Mar 25 at 15:52
The interesting part is, if I disable "Transform Related Text Templates On Save" after this steps, then I can delete all.tt
files... Can you reproduce this too?
– kapsiR
Mar 25 at 15:59
@katit It seems that it is enough to just remove theCustom Tool
from the.edmx
file
– kapsiR
Mar 25 at 16:14
Nope. If I remove Model1.tt - it will recreate both .tt files on "update". Yes, I have "Transform.." disabled
– katit
Mar 25 at 16:23
add a comment |
Looks like this is the best answer so far. You can ALSO delete .context.tt and it will "comply" with it. So, just Model1.tt required
– katit
Mar 25 at 15:52
The interesting part is, if I disable "Transform Related Text Templates On Save" after this steps, then I can delete all.tt
files... Can you reproduce this too?
– kapsiR
Mar 25 at 15:59
@katit It seems that it is enough to just remove theCustom Tool
from the.edmx
file
– kapsiR
Mar 25 at 16:14
Nope. If I remove Model1.tt - it will recreate both .tt files on "update". Yes, I have "Transform.." disabled
– katit
Mar 25 at 16:23
Looks like this is the best answer so far. You can ALSO delete .context.tt and it will "comply" with it. So, just Model1.tt required
– katit
Mar 25 at 15:52
Looks like this is the best answer so far. You can ALSO delete .context.tt and it will "comply" with it. So, just Model1.tt required
– katit
Mar 25 at 15:52
The interesting part is, if I disable "Transform Related Text Templates On Save" after this steps, then I can delete all
.tt
files... Can you reproduce this too?– kapsiR
Mar 25 at 15:59
The interesting part is, if I disable "Transform Related Text Templates On Save" after this steps, then I can delete all
.tt
files... Can you reproduce this too?– kapsiR
Mar 25 at 15:59
@katit It seems that it is enough to just remove the
Custom Tool
from the .edmx
file– kapsiR
Mar 25 at 16:14
@katit It seems that it is enough to just remove the
Custom Tool
from the .edmx
file– kapsiR
Mar 25 at 16:14
Nope. If I remove Model1.tt - it will recreate both .tt files on "update". Yes, I have "Transform.." disabled
– katit
Mar 25 at 16:23
Nope. If I remove Model1.tt - it will recreate both .tt files on "update". Yes, I have "Transform.." disabled
– katit
Mar 25 at 16:23
add a comment |
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?
We dont have Model1.Designer.cs and we don't have Model1.edmx.diagram. When we do "Update Model from Database" they come back. It's EF6.2
– katit
Mar 25 at 15:13
Using 6.2 also, the designer.cs file will get created but it's just got a comment:T4 code generation is enabled for model 'C:sourcereposConsoleApp2DataModel1.edmx'...
Try adding a new model, repeat my steps to see...
– reckface
Mar 25 at 15:19
Just did that and it's restoring tts. I don't think it's source control because I can modify tts and then delete them after saving and it would restore with fresh unmodified tts. Also, when I do model I chose not to save connection string in .config and do the same on "update"
– katit
Mar 25 at 15:25
@katit it's actually impossible for .tt files to be regenerated. There's no mechanism in Visual Studio to recreate .tt files that are associated directly with the model. Tried this with EF5,even changing theCode Generation Strategy
from T4, just creates db context
– reckface
Mar 25 at 16:50
Not sure what do you mean impossible. According to other posters and other answers - people are seeing same behaviour. If you delete .tt files and leave just .edmx - every time you "update" - VS/EF tool will recreate both .tt files.
– katit
Mar 25 at 16:52
|
show 2 more comments
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?
We dont have Model1.Designer.cs and we don't have Model1.edmx.diagram. When we do "Update Model from Database" they come back. It's EF6.2
– katit
Mar 25 at 15:13
Using 6.2 also, the designer.cs file will get created but it's just got a comment:T4 code generation is enabled for model 'C:sourcereposConsoleApp2DataModel1.edmx'...
Try adding a new model, repeat my steps to see...
– reckface
Mar 25 at 15:19
Just did that and it's restoring tts. I don't think it's source control because I can modify tts and then delete them after saving and it would restore with fresh unmodified tts. Also, when I do model I chose not to save connection string in .config and do the same on "update"
– katit
Mar 25 at 15:25
@katit it's actually impossible for .tt files to be regenerated. There's no mechanism in Visual Studio to recreate .tt files that are associated directly with the model. Tried this with EF5,even changing theCode Generation Strategy
from T4, just creates db context
– reckface
Mar 25 at 16:50
Not sure what do you mean impossible. According to other posters and other answers - people are seeing same behaviour. If you delete .tt files and leave just .edmx - every time you "update" - VS/EF tool will recreate both .tt files.
– katit
Mar 25 at 16:52
|
show 2 more comments
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?
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?
edited Mar 25 at 15:17
answered Mar 25 at 15:04
reckfacereckface
3,42822546
3,42822546
We dont have Model1.Designer.cs and we don't have Model1.edmx.diagram. When we do "Update Model from Database" they come back. It's EF6.2
– katit
Mar 25 at 15:13
Using 6.2 also, the designer.cs file will get created but it's just got a comment:T4 code generation is enabled for model 'C:sourcereposConsoleApp2DataModel1.edmx'...
Try adding a new model, repeat my steps to see...
– reckface
Mar 25 at 15:19
Just did that and it's restoring tts. I don't think it's source control because I can modify tts and then delete them after saving and it would restore with fresh unmodified tts. Also, when I do model I chose not to save connection string in .config and do the same on "update"
– katit
Mar 25 at 15:25
@katit it's actually impossible for .tt files to be regenerated. There's no mechanism in Visual Studio to recreate .tt files that are associated directly with the model. Tried this with EF5,even changing theCode Generation Strategy
from T4, just creates db context
– reckface
Mar 25 at 16:50
Not sure what do you mean impossible. According to other posters and other answers - people are seeing same behaviour. If you delete .tt files and leave just .edmx - every time you "update" - VS/EF tool will recreate both .tt files.
– katit
Mar 25 at 16:52
|
show 2 more comments
We dont have Model1.Designer.cs and we don't have Model1.edmx.diagram. When we do "Update Model from Database" they come back. It's EF6.2
– katit
Mar 25 at 15:13
Using 6.2 also, the designer.cs file will get created but it's just got a comment:T4 code generation is enabled for model 'C:sourcereposConsoleApp2DataModel1.edmx'...
Try adding a new model, repeat my steps to see...
– reckface
Mar 25 at 15:19
Just did that and it's restoring tts. I don't think it's source control because I can modify tts and then delete them after saving and it would restore with fresh unmodified tts. Also, when I do model I chose not to save connection string in .config and do the same on "update"
– katit
Mar 25 at 15:25
@katit it's actually impossible for .tt files to be regenerated. There's no mechanism in Visual Studio to recreate .tt files that are associated directly with the model. Tried this with EF5,even changing theCode Generation Strategy
from T4, just creates db context
– reckface
Mar 25 at 16:50
Not sure what do you mean impossible. According to other posters and other answers - people are seeing same behaviour. If you delete .tt files and leave just .edmx - every time you "update" - VS/EF tool will recreate both .tt files.
– katit
Mar 25 at 16:52
We dont have Model1.Designer.cs and we don't have Model1.edmx.diagram. When we do "Update Model from Database" they come back. It's EF6.2
– katit
Mar 25 at 15:13
We dont have Model1.Designer.cs and we don't have Model1.edmx.diagram. When we do "Update Model from Database" they come back. It's EF6.2
– katit
Mar 25 at 15:13
Using 6.2 also, the designer.cs file will get created but it's just got a comment:
T4 code generation is enabled for model 'C:sourcereposConsoleApp2DataModel1.edmx'...
Try adding a new model, repeat my steps to see...– reckface
Mar 25 at 15:19
Using 6.2 also, the designer.cs file will get created but it's just got a comment:
T4 code generation is enabled for model 'C:sourcereposConsoleApp2DataModel1.edmx'...
Try adding a new model, repeat my steps to see...– reckface
Mar 25 at 15:19
Just did that and it's restoring tts. I don't think it's source control because I can modify tts and then delete them after saving and it would restore with fresh unmodified tts. Also, when I do model I chose not to save connection string in .config and do the same on "update"
– katit
Mar 25 at 15:25
Just did that and it's restoring tts. I don't think it's source control because I can modify tts and then delete them after saving and it would restore with fresh unmodified tts. Also, when I do model I chose not to save connection string in .config and do the same on "update"
– katit
Mar 25 at 15:25
@katit it's actually impossible for .tt files to be regenerated. There's no mechanism in Visual Studio to recreate .tt files that are associated directly with the model. Tried this with EF5,even changing the
Code Generation Strategy
from T4, just creates db context– reckface
Mar 25 at 16:50
@katit it's actually impossible for .tt files to be regenerated. There's no mechanism in Visual Studio to recreate .tt files that are associated directly with the model. Tried this with EF5,even changing the
Code Generation Strategy
from T4, just creates db context– reckface
Mar 25 at 16:50
Not sure what do you mean impossible. According to other posters and other answers - people are seeing same behaviour. If you delete .tt files and leave just .edmx - every time you "update" - VS/EF tool will recreate both .tt files.
– katit
Mar 25 at 16:52
Not sure what do you mean impossible. According to other posters and other answers - people are seeing same behaviour. If you delete .tt files and leave just .edmx - every time you "update" - VS/EF tool will recreate both .tt files.
– katit
Mar 25 at 16:52
|
show 2 more comments
You can try this.
- Delete
.tt
files under your.edmx
file. - Project -> Add -> New Item ->
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).- This will not generate new
.tt
files under edmx - And it will not update your entity classes.
- And if you want to update your entity classes, then run
.tt
files.
I tried this and "Update Model From Database" didn't generate new .tt files. So hopefully your problem will be solved.
It would be kind of workaround, however we have multiple .edmx files and having separate templates for each will be messy
– katit
Mar 25 at 15:54
We have this solution in our workspace. Usually we have all edmx in one project (lets say DataLayer) and all entities in another project (Entities). This makes a separation and allows flexibility. Also we have modified our.tt
to generate some custom code (like interfaces for classes).
– fhnaseer
Mar 25 at 16:03
@katit but with this solution, the tt files will now generate any .cs files so your problem will be solved. In fact, I think it's pretty difficult for .tt files to be autogenerated.
– reckface
Mar 25 at 16:04
The good thing is that you don't delete anything. You just keep them separate and update each component whenever you want.
– fhnaseer
Mar 25 at 16:06
add a comment |
You can try this.
- Delete
.tt
files under your.edmx
file. - Project -> Add -> New Item ->
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).- This will not generate new
.tt
files under edmx - And it will not update your entity classes.
- And if you want to update your entity classes, then run
.tt
files.
I tried this and "Update Model From Database" didn't generate new .tt files. So hopefully your problem will be solved.
It would be kind of workaround, however we have multiple .edmx files and having separate templates for each will be messy
– katit
Mar 25 at 15:54
We have this solution in our workspace. Usually we have all edmx in one project (lets say DataLayer) and all entities in another project (Entities). This makes a separation and allows flexibility. Also we have modified our.tt
to generate some custom code (like interfaces for classes).
– fhnaseer
Mar 25 at 16:03
@katit but with this solution, the tt files will now generate any .cs files so your problem will be solved. In fact, I think it's pretty difficult for .tt files to be autogenerated.
– reckface
Mar 25 at 16:04
The good thing is that you don't delete anything. You just keep them separate and update each component whenever you want.
– fhnaseer
Mar 25 at 16:06
add a comment |
You can try this.
- Delete
.tt
files under your.edmx
file. - Project -> Add -> New Item ->
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).- This will not generate new
.tt
files under edmx - And it will not update your entity classes.
- And if you want to update your entity classes, then run
.tt
files.
I tried this and "Update Model From Database" didn't generate new .tt files. So hopefully your problem will be solved.
You can try this.
- Delete
.tt
files under your.edmx
file. - Project -> Add -> New Item ->
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).- This will not generate new
.tt
files under edmx - And it will not update your entity classes.
- And if you want to update your entity classes, then run
.tt
files.
I tried this and "Update Model From Database" didn't generate new .tt files. So hopefully your problem will be solved.
edited Mar 25 at 15:49
answered Mar 25 at 15:43
fhnaseerfhnaseer
3,94594289
3,94594289
It would be kind of workaround, however we have multiple .edmx files and having separate templates for each will be messy
– katit
Mar 25 at 15:54
We have this solution in our workspace. Usually we have all edmx in one project (lets say DataLayer) and all entities in another project (Entities). This makes a separation and allows flexibility. Also we have modified our.tt
to generate some custom code (like interfaces for classes).
– fhnaseer
Mar 25 at 16:03
@katit but with this solution, the tt files will now generate any .cs files so your problem will be solved. In fact, I think it's pretty difficult for .tt files to be autogenerated.
– reckface
Mar 25 at 16:04
The good thing is that you don't delete anything. You just keep them separate and update each component whenever you want.
– fhnaseer
Mar 25 at 16:06
add a comment |
It would be kind of workaround, however we have multiple .edmx files and having separate templates for each will be messy
– katit
Mar 25 at 15:54
We have this solution in our workspace. Usually we have all edmx in one project (lets say DataLayer) and all entities in another project (Entities). This makes a separation and allows flexibility. Also we have modified our.tt
to generate some custom code (like interfaces for classes).
– fhnaseer
Mar 25 at 16:03
@katit but with this solution, the tt files will now generate any .cs files so your problem will be solved. In fact, I think it's pretty difficult for .tt files to be autogenerated.
– reckface
Mar 25 at 16:04
The good thing is that you don't delete anything. You just keep them separate and update each component whenever you want.
– fhnaseer
Mar 25 at 16:06
It would be kind of workaround, however we have multiple .edmx files and having separate templates for each will be messy
– katit
Mar 25 at 15:54
It would be kind of workaround, however we have multiple .edmx files and having separate templates for each will be messy
– katit
Mar 25 at 15:54
We have this solution in our workspace. Usually we have all edmx in one project (lets say DataLayer) and all entities in another project (Entities). This makes a separation and allows flexibility. Also we have modified our
.tt
to generate some custom code (like interfaces for classes).– fhnaseer
Mar 25 at 16:03
We have this solution in our workspace. Usually we have all edmx in one project (lets say DataLayer) and all entities in another project (Entities). This makes a separation and allows flexibility. Also we have modified our
.tt
to generate some custom code (like interfaces for classes).– fhnaseer
Mar 25 at 16:03
@katit but with this solution, the tt files will now generate any .cs files so your problem will be solved. In fact, I think it's pretty difficult for .tt files to be autogenerated.
– reckface
Mar 25 at 16:04
@katit but with this solution, the tt files will now generate any .cs files so your problem will be solved. In fact, I think it's pretty difficult for .tt files to be autogenerated.
– reckface
Mar 25 at 16:04
The good thing is that you don't delete anything. You just keep them separate and update each component whenever you want.
– fhnaseer
Mar 25 at 16:06
The good thing is that you don't delete anything. You just keep them separate and update each component whenever you want.
– fhnaseer
Mar 25 at 16:06
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288485%2fentity-framework-only-edmx-without-templates%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried keeping the .tt files but deleting their content?
– yv989c
Mar 21 at 20:36
Yes. And it would be "kind of" ok but code becomes somewhat "dirty" with extra empty files under each EDMX ModelA.context.tt, ModelA.Context.cs, ModelA.tt, ModelA.cs.
– katit
Mar 21 at 20:53
Just curious: Whats the goal, behind having an EDMX, but no T4 templates, and therefore no Context and Entities? If it's database visualisation, aren't there better tools out there? And why not simple create a new project for the visualization?
– Christian Gollhardt
Mar 21 at 21:22
It's a long story, but basically T4s don't do what we need. We need multi-files generated for different purposes. So, we will have contexts and entities but going to handle generation in our own code (based off EDMX) without using T4s. We can make T4s work I assume but with complexity of what we do it seems that going our own generator will be more maintainable
– katit
Mar 21 at 22:13
I am not exactly sure, but couldn't you make you own generator a Custom Tool (its a property of the edmx) for the edmx? Take a look here, not that I have done that.
– Christian Gollhardt
Mar 21 at 23:39