Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think i have the same problem as i understand from your question.</p> <p><strong>You want to keep your navigational properties names as clear as you can but whenever recreate your Model from edmx ?!.</strong></p> <p>Actually i hope if there is a better solution but here what I'm doing :</p> <ol> <li>Name your relations in DataBase a good names like : <code>FK_Users_CreateUserReport</code>, <code>FK_Users_ApprovedUserReport</code> ... or any suitable names we'll then rename the navigational properties as <code>ApprovedUserReport</code> and <code>CreateUserReport</code> so on ...</li> <li><p>make a helper code to execute whenever you recreate your Model and this code will open your edmx file and makes update to all navigational properties you want something like this:</p> <pre><code>// file here is the path to your edmx file if (!string.IsNullOrEmpty(file)) { var ns = XNamespace.Get("http://schemas.microsoft.com/ado/2008/09/edm"); var doc = XDocument.Load(file); var list = (from xElem in doc.Descendants(ns + "NavigationProperty") where xElem.Attribute("Name").Value.StartsWith("REPORTs")) select xElem).ToList(); foreach (var item in list) { var newName = item.Attribute("Relationship").Value.Split('_').LastOrDefault(); if (!newName.Contains(".")) item.SetAttributeValue("Name", newName); else { var ss = newName.Split('.').LastOrDefault(); } } doc.Save(file); MessageBox.Show(list.Count.ToString()); } </code></pre></li> </ol> <p>Final thing if you used Code Only pattern then this problem is gone but in that case you should keep your Model in agreement with your DataBase by hand.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload