Entity Framework Code First Migration Files Source Control - entity-framework

Wanted to ask this bluntly as I can't seem to find the answer out there.
When I run 'Add-Migration...' 3 new file migration files are created (.cs, .resx, .Designer.cs). In regards to source control, which files should I commit to my repo and what files can I ignore? I'm only interested in the files absolutely necessary to reconstruct my tables if needed.

When I run 'Add-Migration...' 3 new file migration files are created
(.cs, .resx, .Designer.cs). In regards to source control, which files
should I commit to my repo and what files can I ignore?
All 3 files are necessary to reconstruct your database.
the .cs file contains the Up and Down method to help you, respectively, updgrade or downgrade your database.
the .resx file contains the metadata that is used by migrations. It contains the name of the default schema you use (dbo is the default value) and a snapshot of the model at the time the migration was generated.
the .Designer.cs is here because of the presence of .resx. It contains properties that make easy to access settings on the .resx file.
All 3 files need to be committed and pushed in your source control and no one should edit them.

Related

Web API Edmx and Connection String in not cloned

I have a Web API project in TFS it contains all files including edmx files and
connection string in webConfig
When I cloned the project all files are exist in my local machine except the edmx files and connection string.
Why those files are not coming? I tried to get the latest again and they're still not cloned.
Shall I add the Data(ADO.net) manually? is it correct way to do it? and why it's not getting cloned?
Please check with the following things:
How did you clone the repository? Using VS, or git clone command, or other methods? Please try different methods to see if the problem still occurs.
Check whether the .edmx file was added into the .gitignore (if any). If yes, remove it from the .gitignore.
Whether the ADO.NET Entity Data Model project was created by you? If it was created by other people, you need to confirm if the creator has set blocking other user to check out the specific files.

what happens when I copy a checked out code folder under CVS?

I am working with a CVS repository found on a remote server.
I check out the code to a local directory code_local
Then I copy code_local, into code_local_2
Do I have now two independent local copies of the repository? Can I change files, commit, update etc. on each directory independently, is if it was done form two different computers?
(this may depend on the way CVS stores information about a local copy)
Yes I do know it's not a straight forward use of CVS, just asking if it will work
Do I have now two independent local copies of the repository?
Yes you have two independent LOCAL copies.
Can I change files, commit, update etc. on each directory
independently?
No, both copies point to the same file on the same repository. so they are independent as long as you haven't committed them. when committed the last commit operation will overwrite the previous one.
in fact there is a CVS folder beside every folder of your code that keep repository information of files inside that folder. so when you copy a project or a package, the CVS folder will be copied along with, so the same repository entries will be referenced, no matter how many copies have you made.
Even if you past the copied folder to another package hierarchy, whenever you commit the files it will replace the original files in repository where it first created.
If you want to have independent copies you have to copy and place your source code (.java) files only and commit it through Eclipse for example, in this case the CVS plug-in doesn't find any existing CVS folder beside the new folder and generates a new one in the local and new entries in the repository.

Exclude a config file from the merge process

Is there a way to exclude a specified file from the merge process? when merging from our production branch to the test branch for the testers to use, we want to exclude a config file which contains the SQL connection string. Preventing the need to edit it post merge. I did see a comment about using the cloak option but i can only see this available for folders not files.
Tim
There are a few different ways you can do this. If you don't plan on changing your config file in the future and you just don't want its current contents to make it to the parent branch, you could simply do a "tf merge /discard" on the file and check that in. That basically says, never merge the changes that have happened to this file to the target branch. However, if the file changes again, it will be a candidate for a merge.
So, if you plan on continuing to change the config file in question, then you have two options. The first is to always cloak this file in the target branch workspace that you are performing the merge in. Yes, it is possible to cloak files, it is just the picker in the dialog doesn't make this easy. If you navigate all of the way down to the containing folder, select that and then manually enter the file name at the end of the folder string, the cloak will work on the file. This approach has the downside that you have to remember to always cloak this file in the workspace that you are performing the merge in and if someone forgets to do that, the file will be merged up.
The third, and likely best, solution to this problem is to use the tfpt.exe power tool with the branches command to cloak the config file from the parent's branch mappings. You can download the latest 2010 power tools here. You will want to run "tfpt branches /properties /collection:" and then select the "mappings" channel. In there you will probably just see a single mapping for the root of the branch. You will want to create a cloak mapping for the file you do not want to be merged and then click OK. On all subsequent merges to that branch (note, from any other branch) the file in question will not be merged.
Not a very nice solution, but you could remove the checkin security on that file so you are unable to checkin the file after a merge.

SVN - ignoring files already in repository

I have a configuration file in my project which needs to be in the repository (so new developers get it when they checkout the project). Each developer might change some values in the file locally - these changes should not be committed and I don't want them showing in the synchronization menu (I'm using eclipse and subversive if it matters).
Note that I can't just set the svn:ignore property since it only works on files that aren't under version control - but I do want to keep a base version of the file in the repository. How can I avoid the file showing in synchronization without deleting it from repository?
EDIT: A better description - what I actually need is to be able to set a "read-only" property on the config file, so it can't be changed in the repository as long as the property is on. Do you know anything like this?
Thanks
I do this by having a base version of the file checked-in as foo.base, and svn lock this so that it's read-only on checkout. Then have each developer copy this file to their own personal foo file, which is ignored by svn-ignore.
You can't ignore files which are already under version control. The only way to ignore such files is first delete those files do a commit and after that change the svn:ignore property and do a second commit.
If you like to have a kind of Base-Version use a template which has a different name.
You can version template under different name
OR
Read this answer
once u check out, u can lock it, and once it is locked, others will not be able to commit(make changes to svn) that file. see image below
My solution is that a compile time script creates a copy from the original template file if it does not exist. This copy can be put on the ignore list. I feel that locking a file for this purpose abuses the locking feature (it was not created for this).

How can I prevent version control from tracking temporary files?

I am using Mercurial to version my source code and am fairly new to it and still learning about it's abilities. I added my source to a repository by adding the entire folder and all subdirectories.
The problem is that now I have temporary files which show up as 'changed'. I realized I don't need to track these temporary files at all. Is there some way I can tell mercurial to forget all files with a specific extension such as .~temp?
Use an hgignore file: http://www.selenic.com/mercurial/hgignore.5.html