To modify or not to modify the EDMX file - entity-framework

Is it generally a good idea to manually modify the generated EDMX file when working on a .NET project? I had a project once where the developers were modifying the edmx file manually, and it was accepted as a rule to never regenerate the whole EDMX file. For example, one change we made was with some fields whereby we changed them to enum values.
Then I was hired on a project where the developers were telling me to regenerate the EDMX file whenever I made database changes. This was a totally different point of view.
So what is the better solution? Has anyone had any nightmares where one was better than the other.

A general rule is not to edit any auto generated file whether it's EDMX or WinForms designer. However, if there is absolutely no other way and you do need to edit auto-generated class, then do it by using partial class. This way your change won't get lost after the class is regenerated.

Related

EF Code First and Database First in Same Project

As we are working on the refactoring of our current legacy code which is in Database first(EDMX files). We have decided to move on Code First approach, but moving edmx to Code First in a single go would create a lot of testing effort. Is there any way to run EDMX and Code First logic simultaneously in a single project for a time being (Planning to move few classes not completely in a single go).
Please suggest.

How to change Xcode project entirely?

I have an xcode project boilerplate codebase that I am using for my third project.
It has class prefixes from the last project and also the name of the previous project everywhere. plist, pch, project name, schemes, build targets, folders etc.
Also the copyright text in the classes need to be changed to the new one for the new client.
Is there a consolidated way to change all the identity from my previous project to the new one rather than doing it one by one?
You can use Xcode's refactoring tools to rename classes and other identifiers wherever they occur, but you still have to do each identifier individually -- you can't change all the classes at the same time. Find and replace should take care of things like copyright text.
The Edit->Refactor->Rename... command (or control-click on a name to get to the Refactor context menu) is the best way to rename things like classes and variables because it will catch cases you might not have thought of. For example, renaming a class will change the name in storyboard and .xib files.

EF 4.1 POCO template generator conflicting with ClassObjects.Context.cs

I've been using EF 4.1 and the POCO template generator.
I love and hate EF. I love the time I save. I hate maintaining the EDMX file.
But while keeping the EDMX in sync with the database has been a challenge, I'm now overwhelmed by the POCO generator. Up until now, the POCO generator has created POCO's for me and kept the ClassObjects.Context.cs empty and non-conflicting.
After my most recent refresh I have had constant problems with "Amiguity between 'perseus.DataLayer.accounts' and 'perseus.DataLayer.accounts'.
I get this error for every POCO.
I'm on the edge of panicking as I recommended and owned the maintenance of EF. I've spent a couple days on trying everything from database refreshes to deleting all items from the EDMX file and reloading them from the database.
Nothing has made a difference. I have no clue what has suddenly changed from the last few months of relative stability. I'm seriously lost as to what I can do from here.
It looks to me like you have not disabled the code generation strategy. click on the designer background and check the properties tab, the first item is Code Generation Strategy. This should say None, and not Default.
Editing the edmx manually is difficult and error prone. I would suggest copying what you have off to another location then letting the tool regenerate the edmx for you. Compare the two.
I worked with some DB2 entities that I had to manually sync and had constant issues. The tool would clobber my changes and I would have to manually replace that with working code.
If at all possible, don't modify the edmx code yourself. If you must, make the changes, copy those off to a text file in the project for tracking/safe keeping.

Entity framework pre-generating views

I am pre-generating views for the entity data model in my project; following the instruction given by MSDN:
http://msdn.microsoft.com/en-us/library/bb896240.aspx
I have completed the changes without any problem. I can now see CSDL, SSDL and MSL files added to my project. Does this mean I will have to update these files everytime I update my entity data model? If so, its quite a bit of overhead since our database changes quite frequently.
Is there a better way to update these files everytime I update the edmx?
Thanks
You can do what we do in our project:
Open the EDMX and right click the surface-> Properties.
Set Metadata Artifcat Processing to "Copy to Output Directory"
Add the resulting /bin/debug/ .csdl .msl and .ssdl to your project (show all files in solution explorer and right click, Include in Project)
Next set the .csdl .msl and .ssdl properties to be embedded resource.
Build and reference the files in the entity framework connection string in your runtime project.

How to update zfproject.xml file after deleting some controllers, dbtables, etc. in Zend Framework?

I am using Netbeans IDE to work with Zend Framework. When I create a new controller, action, etc.. using Netbeans Zend Command Window, zfproject.xml file is updated automatically. However, when I delete some of them, the file is not updated and still keeps the names that I deleted.
Is there a way (apart from manual way) to update this file?
Is it needed to update zfproject.xml to run the project properly or is it just an organized schema of the project?
Thanks a lot
This is very good question. zfproject.xml often gets out of sync when you use both Zend Tool and manual creating of the files.
Is there a way (apart from manual way) to update this file?
I don't know a good answer for this part. You may try to iterate the application directory structure.
Is it needed to update zfproject.xml to run the project properly or is it just an organized schema of the project?
This is just a schema which is not parsed during the normal application life. Used only by the tools.