Browse Source

Detect id properties as primary keys when they are prefixed with the class name.

pull/18/head
Matt Ward 14 years ago
parent
commit
314c7e0aa6
  1. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Create.cs
  2. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Create.tt
  3. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Delete.cs
  4. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Delete.tt
  5. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Details.cs
  6. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Details.tt
  7. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Edit.cs
  8. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Edit.tt
  9. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/List.cs
  10. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/List.tt
  11. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Create.cs
  12. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Create.tt
  13. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Delete.cs
  14. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Delete.tt
  15. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Details.cs
  16. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Details.tt
  17. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Edit.cs
  18. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Edit.tt
  19. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/List.cs
  20. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/List.tt
  21. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Create.tt
  22. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Delete.tt
  23. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Details.tt
  24. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Edit.tt
  25. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/List.tt
  26. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Create.tt
  27. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Delete.tt
  28. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Details.tt
  29. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Edit.tt
  30. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/List.tt
  31. 1
      src/AddIns/BackendBindings/AspNet.Mvc/Test/AspNet.Mvc.Tests.csproj
  32. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpCreateViewTemplateTests.cs
  33. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpDeleteViewTemplateTests.cs
  34. 11
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpDetailsViewTemplateTests.cs
  35. 11
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpEditViewTemplateTests.cs
  36. 11
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpListViewTemplateTests.cs
  37. 12
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/Models/ModelWithPrefixedIdPropertyInLowerCase.cs
  38. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpCreateViewTemplateTests.cs
  39. 13
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpDeleteViewTemplateTests.cs
  40. 11
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpDetailsViewTemplateTests.cs
  41. 11
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpEditViewTemplateTests.cs
  42. 11
      src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpListViewTemplateTests.cs

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Create.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Create.tt

@ -89,10 +89,23 @@ @@ -89,10 +89,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Delete.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Delete.tt

@ -84,10 +84,23 @@ @@ -84,10 +84,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Details.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Details.tt

@ -86,10 +86,23 @@ @@ -86,10 +86,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Edit.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/Edit.tt

@ -93,10 +93,23 @@ @@ -93,10 +93,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/List.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.AspxCSharp {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/AspxCSharp/List.tt

@ -114,10 +114,23 @@ @@ -114,10 +114,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Create.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Create.tt

@ -85,10 +85,23 @@ @@ -85,10 +85,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Delete.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Delete.tt

@ -80,10 +80,23 @@ @@ -80,10 +80,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Details.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Details.tt

@ -82,10 +82,23 @@ @@ -82,10 +82,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Edit.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/Edit.tt

@ -89,10 +89,23 @@ @@ -89,10 +89,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/List.cs

@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml { @@ -38,10 +38,23 @@ namespace ICSharpCode.AspNet.Mvc.CSHtml {
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

13
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/CSharp/CodeTemplates/AddView/CSHTML/List.tt

@ -110,10 +110,23 @@ @@ -110,10 +110,23 @@
}
bool IsPrimaryKeyProperty(PropertyInfo propertyInfo)
{
return
IsIdProperty(propertyInfo) ||
IsIdPropertyPrefixedWithClassName(propertyInfo);
}
bool IsIdProperty(PropertyInfo propertyInfo)
{
return IsMatchIgnoringCase(propertyInfo.Name, "id");
}
bool IsIdPropertyPrefixedWithClassName(PropertyInfo propertyInfo)
{
string prefixedIdPropertyName = propertyInfo.DeclaringType.Name + "id";
return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName);
}
static bool IsMatchIgnoringCase(string a, string b)
{
return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Create.tt

@ -90,9 +90,19 @@ @@ -90,9 +90,19 @@
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Delete.tt

@ -85,9 +85,19 @@ @@ -85,9 +85,19 @@
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Details.tt

@ -87,9 +87,19 @@ @@ -87,9 +87,19 @@
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/Edit.tt

@ -94,9 +94,19 @@ @@ -94,9 +94,19 @@
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/AspxVisualBasic/List.tt

@ -115,9 +115,19 @@ @@ -115,9 +115,19 @@
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Create.tt

@ -86,9 +86,19 @@ End Using @@ -86,9 +86,19 @@ End Using
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Delete.tt

@ -81,9 +81,19 @@ End Using @@ -81,9 +81,19 @@ End Using
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Details.tt

@ -83,9 +83,19 @@ End Code @@ -83,9 +83,19 @@ End Code
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/Edit.tt

@ -90,9 +90,19 @@ End Using @@ -90,9 +90,19 @@ End Using
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/ItemTemplates/VisualBasic/CodeTemplates/AddView/VBHTML/List.tt

@ -111,9 +111,19 @@ Next @@ -111,9 +111,19 @@ Next
End Sub
Function IsPrimaryKeyProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsIdProperty(propertyInfo) Or _
IsIdPropertyPrefixedWithClassName(propertyInfo)
End Function
Function IsIdProperty(ByVal propertyInfo As PropertyInfo) As Boolean
Return IsMatchIgnoringCase(propertyInfo.Name, "id")
End Function
Function IsIdPropertyPrefixedWithClassName(ByVal propertyInfo As PropertyInfo) As Boolean
Dim prefixedIdPropertyName As String = propertyInfo.DeclaringType.Name + "id"
Return IsMatchIgnoringCase(propertyInfo.Name, prefixedIdPropertyName)
End Function
Shared Function IsMatchIgnoringCase(ByVal a As String, ByVal b as String) As Boolean
Return String.Equals(a, b, StringComparison.OrdinalIgnoreCase)
End Function

1
src/AddIns/BackendBindings/AspNet.Mvc/Test/AspNet.Mvc.Tests.csproj

@ -95,6 +95,7 @@ @@ -95,6 +95,7 @@
<Compile Include="Src\CodeTemplates\Models\ModelWithIdPropertyInLowerCase.cs" />
<Compile Include="Src\CodeTemplates\Models\ModelWithNoProperties.cs" />
<Compile Include="Src\CodeTemplates\Models\ModelWithOneProperty.cs" />
<Compile Include="Src\CodeTemplates\Models\ModelWithPrefixedIdPropertyInLowerCase.cs" />
<Compile Include="Src\CodeTemplates\Models\ModelWithTwoProperties.cs" />
<Compile Include="Src\CodeTemplates\RazorCSharpCreateViewTemplateTests.cs" />
<Compile Include="Src\CodeTemplates\RazorCSharpDeleteViewTemplateTests.cs" />

13
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpCreateViewTemplateTests.cs

@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Create.ModelProperty GetModelProperty(string name)
{
return GetModelProperties().Single(p => p.Name == name);
return GetModelProperties().First(p => p.Name == name);
}
[Test]
@ -355,5 +355,16 @@ MyView @@ -355,5 +355,16 @@ MyView
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Create.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

13
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpDeleteViewTemplateTests.cs

@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Delete.ModelProperty GetModelProperty(string name)
{
return GetModelProperties().Single(p => p.Name == name);
return GetModelProperties().First(p => p.Name == name);
}
[Test]
@ -327,5 +327,16 @@ MyView @@ -327,5 +327,16 @@ MyView
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Delete.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

11
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpDetailsViewTemplateTests.cs

@ -348,5 +348,16 @@ MyView @@ -348,5 +348,16 @@ MyView
Assert.AreEqual(String.Empty, primaryKeyName);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Details.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

11
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpEditViewTemplateTests.cs

@ -390,5 +390,16 @@ MyView @@ -390,5 +390,16 @@ MyView
Assert.AreEqual(String.Empty, primaryKeyName);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Edit.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

11
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/AspxCSharpListViewTemplateTests.cs

@ -398,5 +398,16 @@ MyView @@ -398,5 +398,16 @@ MyView
Assert.AreEqual(String.Empty, primaryKeyName);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
AspxCSharp.List.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

12
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/Models/ModelWithPrefixedIdPropertyInLowerCase.cs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace AspNet.Mvc.Tests.CodeTemplates.Models
{
public class ModelWithPrefixedIdPropertyInLowerCase
{
public int modelwithprefixedidpropertyinlowercaseid { get; set; }
}
}

13
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpCreateViewTemplateTests.cs

@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Create.ModelProperty GetModelProperty(string name)
{
return GetModelProperties().Single(p => p.Name == name);
return GetModelProperties().First(p => p.Name == name);
}
[Test]
@ -356,5 +356,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -356,5 +356,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Create.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

13
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpDeleteViewTemplateTests.cs

@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -37,7 +37,7 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Delete.ModelProperty GetModelProperty(string name)
{
return GetModelProperties().Single(p => p.Name == name);
return GetModelProperties().First(p => p.Name == name);
}
[Test]
@ -328,5 +328,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -328,5 +328,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Delete.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

11
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpDetailsViewTemplateTests.cs

@ -349,5 +349,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -349,5 +349,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Assert.AreEqual(String.Empty, primaryKeyName);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Details.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

11
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpEditViewTemplateTests.cs

@ -391,5 +391,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -391,5 +391,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Assert.AreEqual(String.Empty, primaryKeyName);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
Edit.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

11
src/AddIns/BackendBindings/AspNet.Mvc/Test/Src/CodeTemplates/RazorCSharpListViewTemplateTests.cs

@ -399,5 +399,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates @@ -399,5 +399,16 @@ namespace AspNet.Mvc.Tests.CodeTemplates
Assert.AreEqual(String.Empty, primaryKeyName);
}
[Test]
public void GetModelProperties_ModelHasPrefixedIdPropertyInLowerCase_PrefixedIdPropertyIsMarkedAsPrimaryKey()
{
CreateViewTemplatePreprocessor();
mvcHost.ViewDataType = typeof(ModelWithPrefixedIdPropertyInLowerCase);
CSHtml.List.ModelProperty modelProperty = GetModelProperty("modelwithprefixedidpropertyinlowercaseid");
Assert.IsTrue(modelProperty.IsPrimaryKey);
}
}
}

Loading…
Cancel
Save