Entity Framework - .cs files are getting deleted under .tt file

Hi,

I am working in Entity framework version version 6.0.

When ever I do "update model from database" on entity designer, it removes all .cs file under the .tt files. It is hard
to get them back. These cs files are named by the database table names.

Can someone help me how can I prevent all .cs files from being deleted under .tt file?

Thanks
r_pat72Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
That is by design. If you look at the top of those files the warn about this. Are you modifying these files and losing your modifications? If so you need to make these modification in another file with the same class name, A partial class, which at compile time gets combined with the class created by entity framework.
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fernando SotoRetiredCommented:
If this is not the case please tell us why you want to stop this functionality?
0
Prakash SamariyaIT ProfessionalCommented:
It is default feature of EF, as if we change in a table in a database, we don’t have to find and change the name of the corresponding C# class. Instead, we can re-execute the template and regenerate the class definitions.  And it should work automatically when you save your EF model and Build your project!

Either you can also force a template to generate class by right clicking on a template [.tt] and selecting “Run Custom Tool” from the context menu.
0
r_pat72Author Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.