cah1r
cah1r

Reputation: 1969

Edmx update model add blank lines from autogeneration

I have an annoying problem and can't seem to figure out what's causing it. On my machine when I try to use Update Model from Database... on Edmx file in EF Database first approach the autogenerated model has blank lines between properties. This doesn't seem to occure on other developers machines even though we have same versions of VS , extensions etc.

Problem is that even when I add for example one new table the refresh automatically adds blank lines for all mapped tables. Later all of this is visible as conflict during merge operations in GIT.

Would really appreciate any help since I did't find a single shred of information on this issue anywhere and this really disrupts work.

Upvotes: 6

Views: 983

Answers (2)

fusion27
fusion27

Reputation: 2636

What worked for me

💡Turns out it was how my OS was ending lines

  1. Working in Windows. Earlier disabled "auto carriage returns (CR) + line feeds (LF) line endings" in global Git configuration, reenabled:
    git config --global core.autocrlf true
    

    FYI 'nix/Mac ends lines w/ LFs only, Windows end lines w/ CRs + LFs

  2. Opened up *DataModel.tt and *DataModel.Context.tt in Notepad++
  3. Edit > EOL Conversions > Windows (CR LF) > Save
  4. Refresh EDMX

Looking for a better terminal-based solution, sounds like dos2unix will come in to play at some point. Will amend this as soon as I've ironed this out.

Upvotes: 3

cah1r
cah1r

Reputation: 1969

I checked the files (Model.tt on my machine and my friends) using Notepad++ comparer and it said there are no differences but the encoding is different. When I copied Model.tt manually and did the update the blank lines were gone.... Must be some kind of quirk.

Posting as an answer since I wasted few hours on this and someone might have simmilar problem.

Upvotes: 2

Related Questions