Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
Skip routines having invalid ParameterMode.
Browse files Browse the repository at this point in the history
Undup routine parameter names.
  • Loading branch information
kenjiuno committed Nov 20, 2014
1 parent 4ad32a5 commit bfe4e93
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions EdmGenModelGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,18 @@ public void ModelGen2(String connectionString, String providerName, String typeP
break;
}

if (String.IsNullOrEmpty(nut.SsdlParameterMode(dbfp))) {
ssdlFunction.AddAfterSelf(new XComment(String.Format("Function {0} removed. Unknown SsdlParameterMode {1}"
, ssdlFunction.Attribute("Name")
, nut.SsdlParameterMode(dbfp))
));

ssdlFunction.Remove();
csdlFunctionImport.Remove();
mslFunctionImportMapping.Remove();
break;
}

var ssdlParameter = new XElement(xSSDL + "Parameter"
, new XAttribute("Name", nut.SsdlParameterName(dbfp))
, new XAttribute("Mode", nut.SsdlParameterMode(dbfp))
Expand All @@ -584,6 +596,18 @@ public void ModelGen2(String connectionString, String providerName, String typeP
break;
}

if (String.IsNullOrEmpty(nut.CsdlParameterMode(dbfp))) {
ssdlFunction.AddAfterSelf(new XComment(String.Format("Function {0} removed. Unknown ParameterMode {1}"
, ssdlFunction.Attribute("Name")
, nut.CsdlParameterMode(dbfp))
));

ssdlFunction.Remove();
csdlFunctionImport.Remove();
mslFunctionImportMapping.Remove();
break;
}

var csdlParameter = new XElement(xCSDL + "Parameter"
, new XAttribute("Name", nut.CsdlParameterName(dbfp))
, new XAttribute("Mode", nut.CsdlParameterMode(dbfp))
Expand Down Expand Up @@ -861,12 +885,30 @@ public String SsdlFunctionRef(Routine dbf) {
return String.Format("{0}.{1}", SsdlNs(), dbf.Name);
}

SortedDictionary<String, bool> dictSsdlParameterName = new SortedDictionary<string, bool>();

public String SsdlParameterName(Parameter dbfp) {
return String.Format("{0}", dbfp.Name);
for (int x = 0; ; x++) {
String a = String.Format("{0}{1}", dbfp.Name, (x == 0) ? "" : "" + x);
String k = dbfp.Routine.CatalogName + ":" + dbfp.Routine.Id + ":" + a;
if (dictSsdlParameterName.ContainsKey(k)) continue;

dictSsdlParameterName[k] = true;
return a;
}
}

SortedDictionary<String, bool> dictCsdlParameterName = new SortedDictionary<string, bool>();

public String CsdlParameterName(Parameter dbfp) {
return String.Format("{0}", dbfp.Name);
for (int x = 0; ; x++) {
String a = String.Format("{0}{1}", dbfp.Name, (x == 0) ? "" : "" + x);
String k = dbfp.Routine.CatalogName + ":" + dbfp.Routine.Id + ":" + a;
if (dictCsdlParameterName.ContainsKey(k)) continue;

dictCsdlParameterName[k] = true;
return a;
}
}

public String SsdlParameterMode(Parameter dbfp) {
Expand Down

0 comments on commit bfe4e93

Please # to comment.