Граф коммитов

1777 Коммитов

Автор SHA1 Сообщение Дата
Regis Bittencourt 14af553f99 Missing comma in jquery.unobtrusive-ajax.js creates a Global variable. 2014-04-04 09:59:55 -07:00
fenzhao e9f099a5c1 resolve further comments for lower camel case 2014-04-03 09:41:09 +08:00
Tian Pan 736aae76aa Fix 1737: Make TypeHelper.ObjectToDictionary(routeValues) public. 2014-04-02 13:12:27 -07:00
Tian Pan 22c91621ca Fix 1566: [HelpPage]Change UriParameters display when a parameter with TypeConverter is used
Since we do not know how the string will be parsed with a TypeConverter when generating the
sample query string, just do not display member properties of the type which is associated
with a TypeConverter. Instead, the type itself will be displayed.
2014-04-02 13:04:31 -07:00
Tian Pan 02ea2b8ca6 Fix 1567(2/2): [HelpPage]Api uri not displaying parameter which is a collection of primitive types and coming from Uri.
This is a separated PR fixing 1567:
        - Add support for generating query string of type Dictionary and KeyValuePair.
        - Replace '.' with '-' in GetFriendlyId. Otherwise, RelativePath with . (like ModelType.Foo or ModelType[0].Foo)
          will break the help page's uri
        - Change the css of help page to make a long path more readable.
2014-04-02 12:46:06 -07:00
Tian Pan 37c3da761e Fix 1567(1/2): [HelpPage]Api uri not displaying parameter which is a
collection of primitive types and coming from Uri.

     - Add support for primitive/complex collection(and arrays).
     - separate helpers and increase readability.
2014-04-02 12:46:05 -07:00
fenzhao 0aed73aa6a 1758: support lower camel case 2014-03-25 15:32:17 +08:00
trdai 4a9a2e8f8f Fix SA1514 on AreaReference.cs 2014-03-20 15:09:47 -07:00
dougbu 38c7ae6c58 Address CR comments on previous commit
- add XML comments
- use named parameters in added test methods (clarify nulls)
- rename added test methods to make expectations clear
- add three new tests to cover gaps
2014-03-20 09:38:59 -07:00
shibayan d41f1ba068 Fixed behavior when combined area and Remote attribute
By adding a AreaReference enum, to be capable of setting Remote attribute or use the area which.
So, fix the problem of not being able to refer to the controller outside the area from inside the area.
2014-03-20 09:38:56 -07:00
Tian Pan 28ad38057a Fix 1726: Add ITempDataProviderFactory helping to create new instance per request
in Controller.CreateTempDataProvider().
2014-03-16 22:13:46 -07:00
jinfutan 241d2a639d Fix bug # 1747: FilterBinder treats nullable double as decimal. 2014-03-15 07:06:58 -07:00
Tian Pan 9517c374c0 Fix 1703: Add extra constructors to SelectList/MultiSelectList class making it easier
to create grouped lists.
2014-03-13 11:12:41 -07:00
Tian Pan 2d362ff39f Fix 1110 Trace more information from authentication filter tracers. 2014-03-12 15:42:09 -07:00
Tian Pan 58a4a69a3c Fix Support `disabled` attribute in <option> and <optgroup> from
SelectList.
2014-03-12 15:12:45 -07:00
Tian Pan c304be8994 Partially fix 1692. Using DependencyResolver with IActionInvoker the
resolved instances are only created once and then shared.

This fix only aims at the CreateActionInvoker() in the MVC Controller.
CreateTempDataProvider() will be fixed in a separate issue.
2014-03-12 14:26:26 -07:00
jacalvar fd9f0b7432 Added support for JsonProperty in $select and $expand projections
for the JsonMediaType formatter in System.Web.OData (OData v4.0)

DataMember is already supported through ModelAliasing
2014-03-12 11:06:47 -07:00
jacalvar e3503da696 Refactor ISelectExpandWrapper to add a ToDictionary method that takes
in an IPropertyMapper that allows for renaming of the properties during
serialization. (OData v4.0)
2014-03-12 11:06:46 -07:00
jacalvar 40494d378c Enabled model aliasing by default in Web API OData for v4.0.
Moved ModelAliasingEnabled from ODataModelBuilder to ODataConventionModelBuilder.
Refactored the OData model builder conventions to take in an ODataConventionModelBuilder
instance.
2014-03-11 11:21:13 -07:00
jacalvar aebf4868a2 Added support for JsonProperty and DataMember in $select
and $expand projections in the JsonMediaType formatter
in System.Web.Http.OData (OData v3.0)
2014-03-10 13:27:03 -07:00
jacalvar b92c0b7de3 Refactor ISelectExpandWrapper to add a ToDictionary method that takes
in an IPropertyMapper that allows for renaming of the properties during
serialization. (OData v3.0)
2014-03-10 13:26:54 -07:00
Ryan Nowak ced363bb59 Adding support for custom discovery of IRouteFactory
The new IDirectRouteProvider api supports discovering IRouteFactory
on controller descriptors and action descriptors with arbitrary criteria.

DefaultDirectRouteProvider is given as a base class for customizing a
single aspect of the process.

Since criteria for whether or not an action/controller is attribute
routed is now arbitrary, I've added a marker to the descriptors. This
required some refactoring of the action selector, now caching proceeds in
two phases.

1. Existance of actions and descriptors are cached
2. Details used for action selection are cached.

2) will happen when requests come in, so attribute routing is allowed to
mark the descriptors before they are cached.
2014-02-27 15:00:38 -08:00
jacalvar a31eab7e87 Issue 1676 - Expose IDictionaryConvertible for advanced query composition
scenarios.

Renamed IDictionaryConvertible to ISelectExpandWrapper, made the
interface public public and changed the return type of its ToDictionary
method to IDictionary in order to allow using custom JsonConverters with
$select and $expand projections in both assemblies (v3 and v4).
2014-02-26 14:20:31 -08:00
Tian Pan d5af8f5f39 Work Item 1110 Trace more information from authentication filter tracers.
Now it will be logged that a authentication filter short-circuits or sets a principal.
2014-02-25 14:40:33 -08:00
Congyong Su 0287c8256d Fix 1717 : Batch request doesn't work
Do not copy request property "MS_RoutingContext" from batch request to sub-requests.
2014-02-25 16:07:25 +08:00
Max Toro 7106bb356b Fix #1687: [EditorTemplates] Support htmlAttributes as IDictionary<string, object> for dynamic scenarios 2014-02-24 18:06:56 -08:00
Congyong Su a7ef4f5ed4 1715 : Removing EntitySetController and AsyncEntitySetController 2014-02-24 14:01:40 +08:00
Congyong Su 17004866e8 Fix 1690 : IfNoneMatch doesn't work
The expression should be parameterized
The expression should be Not Equal instead of Equal
2014-02-24 13:46:25 +08:00
dougbu a452f2a267 Fix #1693, route resolution failure for /$metadata in SxS scenarios
- Rename ODataMetadataController to avoid route ambiguity
2014-02-21 14:53:19 -08:00
jacalvar 09e8468a33 Issue 1699 - All functions and actions are added as function imports and action imports.
https://aspnetwebstack.codeplex.com/workitem/1699

Per protocol bound action/function should not be added as
actionImport/functionImport. But now they become imports.

This bug is a regression from a previous checkin. I've fixed the bug and added
the respective unit tests to cover the cases that weren't tested and that caused
the behavior change to go undetected.
2014-02-21 14:38:20 -08:00
Tian Pan f718787ad4 CR Feedback. 2014-02-21 12:22:28 -08:00
Sam Xu 105a5304a5 [Codeplex #1695]: Only function/action import name used to call an unbound
action/function.

ODL Spec Says:

11.5.3.1 Invoking a Function

...To invoke a function through a function import the client issues a GET
request to a URL identifying the function import and passing parameter
values using inline parameter syntax. The canonical URL for a function
import is the service root, followed by the name of the function import.
...

11.5.4.1 Invoking an Action

...To invoke an action through an action import, the client issues a POST
request to a URL identifying the action import. The canonical URL for an
action import is the service root, followed by the name of the action
import.
2014-02-21 09:52:32 +08:00
Tian Pan 0326980c42 Work Item 1486 Support HTML optgroup in DropDownList.
Add property `Group` into SelectListItem. Now DropDownList
, along with other kinds of select list, can render the <optgroup>
tag wrapping options if `Group` is set.
2014-02-20 13:46:24 -08:00
Congyong Su 582809a52b Fix 1578 : Rename method AddEntity to AddEntityType
1. Rename method AddEntity to AddEntityType.
2. Change method Entity() to EntityType().
2014-02-20 15:48:15 +08:00
Sam Xu 82b9599166 [Codeplex #1661] : Unqualified action/function name should fail when call
this action/function

[ODL spec says in 11.5.3.1 Invoking a Function]
To invoke a function bound to a resource, the client issues a GET request
to a function URL. A function URL may be obtained from a previously
returned entity representation or constructed by appending the namespace-
or alias-qualified function name to a URL that identifies a resource whose
type is the same as, or derived from, the type of the binding parameter of
the function. ....
2014-02-20 10:27:46 +08:00
Sam Xu 56f99af3c0 [Codeplex #1685]: Qualified name of action/function should be returned in
advertising.
2014-02-20 09:33:27 +08:00
Pranav K e0a53c23c6 Modify HttpControllerHandler.ConvertRequest to not throw if request can be
read from Request.InputStream

If the result of GetBufferedInputStream was completely read, the buffered
stream is available via Request.InputStream. We can attempt to use instead
of proactively throwing.

Work Item: 1696
2014-02-19 12:24:29 -08:00
fenzhao 8d87c8682c fix 1689: KeyValueParser should throw without key or value 2014-02-19 10:35:02 +08:00
Congyong Su 5007766cde Change $link to $ref
$ref is the last segment in v4.

work item: #1582
2014-02-18 22:30:24 +08:00
Sam Xu d0859354f2 [Codeplex #1653]: For bound actions, the combination of action name and
the binding parameter type MUST be unique within a namespace.

In this fix, a validation function added in GetEdmModel() to validate the
action overload:

1. For bound action overload, each overload action must have differnt
bingding type.
2. For unbound action, each unbound action must have different action
name.

Thanks.
2014-02-18 17:08:17 +08:00
Congyong Su 4a7698d13a Fix 1643 : SelectExpandQueryOption doesn't create the select expand clause properly 2014-02-18 16:41:47 +08:00
Sam Xu 05bd3b0aec Update codes related to codeplex #1672: There are 2 function-import
elements in ServiceDocument if a function is overloaded and exposed as
FunctionImport.
2014-02-18 13:38:30 +08:00
Tian Pan e45d14212e Work Item 1683 [HelpPage] ApiExplorer throws exception when
trying to expand uri parameters.

Set parameterValuesForRoute ignore case and check whether it
contains the key before adding a new entry.
2014-02-17 18:05:43 -08:00
Pranav K c332dafd1a Suppressing CodeAnalysis violation in ODataConventionModelBuilder 2014-02-17 16:17:56 -08:00
Pranav K 4ef8fdae69 Merge remote-tracking branch '561/master' 2014-02-17 13:45:04 -08:00
Pranav K fc79dd536a Merge remote-tracking branches '1598/master', '520/master', 'foo/master' and 'bar/master' 2014-02-17 13:41:41 -08:00
Tian Pan d5d326b8fc Work Item 1530 Add System.Web.Mvc.ModelMetadata.Container property. 2014-02-14 14:10:37 -08:00
jacalvar a12032f07d Issue 1423 - Support ComplexTypeAttribute, AssociationAttribute, TimestampAttribute
and ConcurrencyCheckAttribute in ODataConventionModelBuilder
https://aspnetwebstack.codeplex.com/workitem/1423

Added support for ComplexTypeAttribute and TimestampAttribute, support for
ConcurrencyCheckAttribute already existed. Support for AssociationLinkAttribute
requires changes on the way we build the model that are out of the scope of
this fix.
2014-02-14 13:00:26 -08:00
jacalvar d88630c387 Issue 1598 - Can filter and order on relationships that are not navigable
https://aspnetwebstack.codeplex.com/workitem/1598

Setting is not navigable should also set IsNonFilterable and IsUnsortable
but not the opposite (setting IsNavigable should not set IsSortable or
IsFilterable)
2014-02-14 12:58:59 -08:00
jacalvar 3a8db6d83c Issue 1596 - Unsortable query limitation doesn't work for complex objects
Given a model with an entity, and a complex object. When we limit ordering in
the complex object it doesn't get respected and the following query succeeds
instead of returning bad request.

"/odata/QueryLimitCustomers?$orderby=HomeAddress/ZipCode"
2014-02-14 12:57:32 -08:00
jacalvar c5afbeeaca Issue 520 - Provide ability to supply friendly Title for actions
https://aspnetwebstack.codeplex.com/workitem/520

When the user sets the title in the ProcedureConfiguration class,
we'll write that title in json full metadata, atom and json verbose.
2014-02-14 11:00:38 -08:00
jacalvar 458084c767 Codeplex Issue 561 - Conventional builder should throw error when it cannot
find a key for an entity type - https://aspnetwebstack.codeplex.com/workitem/561
2014-02-13 16:56:07 -08:00
Sam Xu 0d72141fc1 [Codeplex # 1672]: There are 2 function-import elements in ServiceDocument
if a function is overloaded and exposed as FunctionImport.

This fix is follow up the following ODL Spec:
The edm:FunctionImport for a parameterless function MAY include the
IncludeInServiceDocument attribute whose Boolean value indicates whether
the function import is advertised in the service document.
2014-02-13 11:01:10 +08:00
fenzhao 4679a1f19c fix issue 1641: IQueryable<IEdmEntityObject> doesn't get serialized properly 2014-02-13 09:57:20 +08:00
Alex Batishchev 85e133a695 Adding method AddRange() to HttpFilterCollection. Refactoring internals. Adding tests 2014-02-12 15:58:27 -08:00
Sam Xu 1cd759ee8f 1. Codeplex #1650 : It is unable to select the correct function if the
function is overloaded and bound to a derived entity.
2. Codeplex #1654 : In convention routing mode, the same method in a
controller is selected if action overloads for a collection of base type
and one for derived type are requested.
2014-02-12 10:15:06 +08:00
Ryan Nowak f3056a0e03 Optimizing routing performance with many routes
This change splits the 'sanitization' of a request URL into a separate
helper function and ensure that it only occurs once per request.
Sanitizing the request URL is responsible for about 60% of routing
execution time in today's routing code.

There's also an optimization applied to perform faster validation of the
virtual path portion of the URL.
2014-02-11 12:31:57 -08:00
Tian Pan 891791e56d Work Item 1624
[HelpPage Accessibility] Add language attribute to html files.
2014-02-11 10:57:13 -08:00
Tian Pan a37e57720c Work Item 1625 Satisfy Visible Text Contrast requirements. 2014-02-11 10:45:09 -08:00
Congyong Su 5338316577 Fix 1580 : BindRound method binds nullable double as decimal 2014-02-12 00:31:18 +08:00
Congyong Su f3eb6d924c Fix 1608 : ODataUriUtils.ConvertToUriLiteral does not support Enum
Fix ConventionsHelpers.GetUriRepresentationForValue.
ODL beta1 now supports ODataEnumValue in ConvertToUriLiteral
2014-02-11 20:22:54 +08:00
Sam Xu 245a573d6b codeplex 1652: It reports error if an entity set name is followed by a type cast in URL. 2014-02-11 09:33:28 +08:00
fenzhao 395d93595c 1458 Fix parsing single key value which contains '=' in KeyValueParser 2014-02-01 09:35:30 +08:00
Yishai Galatzer 1e6b50cbe2 Fix CodePlex bug: https://aspnetwebstack.codeplex.com/workitem/1658
Url.Action overloads (and similar) ignore inherited properties.

This fix affects both WebAPI HttpRouteValueDictionary,
Overloads that take anonymous objects to construct a routevaluedictionary
and overload that takes anonymous objects to create HtmlAttributes.

The fix reverts the behavior to MVC5/WebAPI2/WebPages3 behavior where it will allow for derived properties to show up.
But it maintains the performance characteristics of MVC5.1/WevAPI2.1/WebPages3.1.
2014-01-29 17:41:36 -08:00
dougbu 7c3c68dd79 Clear OData classes out of System.Net.Http and System.Web.Http
- Allow side-by-side use of all v3 / v4 extension methods and classes we previously injected into these namespaces

Move extension methods to System.Web.Http.OData.Extensions and System.Web.OData.Extensions
- Rename these methods to let users referencing the v3 assembly continue using them as extension methods
- Make most HttpRequestMessage extension methods properties of a new HttpRequestMessageProperties class
- Leave old locations in v3 assembly for binary compatibility but deprecate them to help users find the new locations

Narrow scope of a few internal extension methods
- Move RemoveRange to ODataFormattingAttribute (otherwise unused)
- Move one CreateErrorResponse overload to ODataActionSelector (otherwise unused)

Type forward SingleResult and SingleResult<T> to System.Web.Http.dll
- Currently special-cased only in OData [EnableQuery] scenarios but could be used elsewhere

Move remaining classes in System.Net.Http and System.Web.Http to System.Web.Http.OData and system.Web.OData
- Rename QueryableAttribute (the remaining public class) to EnableQueryAttribute

Other cleanup
- Run Remove and Sort Usings power tool, touching a few otherwise-unchanged files
- Remove implementations of MediaTypeFormatterCollection extension methods (moved to System.Web.Http.dll in earlier change)
- Improve wording of XML Comments, especially in EnableQueryAttribute and HttpRequestMessageExtensions
- Wrap to shorten long lines
2014-01-28 22:25:28 -08:00
Pranav K 3974b68329 Update HttpControllerHandler.ConvertRequest to handle scenarios when the
RequestStream has already been read.

Work Item: 1659
2014-01-28 16:49:59 -08:00
fenzhao 62b36776b6 1494 fix ToArray() calls over-used 2014-01-28 16:11:54 +08:00
fenzhao 98b7ff0611 #1576 Correct typo in comment of EntityTypeConfiguration.Collection 2014-01-27 13:09:02 +08:00
davidmatson 8e9a2d00e5 Don't use ClientDisconnectedToken on unsupported platforms (fixes #1644). 2014-01-24 10:26:41 -08:00
Congyong Su f57492ac70 Remove entity set path from UnboundFunctionPathSegment
1. Remove check for "if (serializer.ODataPayloadKind != ODataPayloadKind.Error)", since 669 is fixed.
 2. Remove entity set path from UnboundFunctionPathSegment as per ODL v4 spec.

Work Item: #1632
2014-01-24 00:01:26 +08:00
fenzhao 248649646a Fix isssue #1642:
The enum memeber is not generated by ODataConventionModelBuilder
if the enum type is used by an action or function.
2014-01-23 11:02:53 +08:00
Sam Xu 758e92405d Fix codeplex issues:
1. #1620: FunctionImport doesn't apppear in the service document even
if IncludeInServiceDocument is true.
2. #1601: Add FunctionImports and Singletons to service document
3. #1636: Don't build action/function import for bound
action/function
2014-01-23 09:49:29 +08:00
dougbu 53c3d13f80 Update namespaces in System.Web.OData.dll and System.Web.OData.Test.dll
- System.Web.Http.OData -> System.Web.OData
- Merge System.Web.Http.OData.TestCommon and System.Web.Http.TestCommon into System.Web.OData.TestCommon
- Add usings for System.Web.Http where necessary
- Remove and sort usings

Move AddRange and InsertRange extensions to base MediaTypeFormatterCollections class
- Feature is now available to all MediaTypeFormatterCollections users
- Obsolete extension methods in System.Web.Http.OData.dll
- Remove most of ODataMediaTypeFormatterCollectionExtensions extension class in System.Web.OData.dll

Will handle remaining extension methods in System.Net.Http and System.Web.Http namespaces in a separate review
2014-01-22 09:53:50 -08:00
Pranav K e663ab6034 Updating id selector generation in AjaxOptions to handle special
characters

According the HTML5 specs, all characters besides space characters are
allowed in DOM ids. Consequently we need to ensure that certain characters
such as dot, colon and square brackets which can be interpreted as other
forms of jQuery selectors are correctly escaped.

Work Item: 1617
2014-01-20 16:52:29 -08:00
Pranav K 368c31d1f0 Updating jQuery Unobtrusive Ajax to use preferred and non-deprecated
functions.

Work Item: 1610
2014-01-20 16:41:28 -08:00
Congyong Su 1dfa8567b9 webapi.odata update to v4 beta1 ODL
Update from v4 alpha2 to beta1 ODL:
 1. ODataWorkspace -> ODataServiceDocument
 2. Collection Type ref: isNullable inferred from element type ref
 3. EdmTypeKind.Row is gone
 4. Single container: IsDefaultContainer is gone
 5. entry.Id is now a Uri
 6. ODataMessageWriterSettings.BaseUri -> PayloadBaseUri
 7. SetMetadataDocumentUri is gone -> SetServiceDocumentUri
 8. ContainerQualifiedWildcardSelectItem is gone -> NamespaceQualifiedWildcardSelectItem
 9. ParseSelectAndExpand parameter change
   entitySet -> entitySetBase
 10. navMapping.TargetEntitySet -> Target
 11. SetIsDefaultEntityContainer is gone
   EdmRowTypeReference is gone
 12. IEdmRowTypeReference is gone
 13. ReturnType of Function in csdl
   Child element, instead of an attribute
 14. Context url change: http://localhost/$metadata#Collection(Edm.Boolean)
 15. Self link is gone, if the same to edit link
 16. ServiceDocument is now default to json, instead of atom
 17. MessageWriter by default writes json, instead of atom
 18. Collection's nullablity is determined by its element
   If no value is specified for a property whose Type attribute does not specify a collection, the Nullable attribute defaults to true
 19. ODataMessage writer settings require a service document uri
 20. "@odata.type":"Edm.Binary" -> "@odata.type":"#Binary"
 21. Select action of a derived type from a base type, need to use type cast before action
 22. Action should be prefixed with namespace

Work Item: #1632
2014-01-17 15:51:42 +08:00
Sam Xu 1a5d673d51 replace streaming to odata.streaming
Codeplex - #1591

change streaming to odata.streaming in media type based on ODL V4.
2014-01-17 15:28:12 +08:00
Sam Xu 70cc98d932 Refine the codes of bound action and function
Codeplex - #1622

1. Rename the ActionPathSegment to BoundActionPathSegment
2. Rename the FunctionPathSegment to FunctionPathSegment
3. Change IEdmActionImport to IEdmAction
4. Change IEdmFunctionImport to IEdmFunction
5. Modify helper codes in FunctionResolver and ProcedureHelper
6. Modify test cases and add more test casesn.
2014-01-17 14:07:17 +08:00
dougbu 31c7152fbe Correct warnings that show up in some build configurations
- No impact except to clean up those builds
2014-01-16 14:49:02 -08:00
davidmatson fdff766778 Fix IOverrideFilter documentation. 2014-01-15 09:58:56 -08:00
Sam Xu e5c69c1247 Replace $inlinecount to $count based on ODL V4.
Codeplex - #1585

1. In ODL V4, It has changed $inlinecount to $count.
2. The value for $count is only true or false.
3. The true and false is case-insensitive.
2014-01-15 17:44:48 +08:00
Sam Xu e38bca9d66 Codeplex - #1614
Match the function name first, then the parameter in the function path
segment template
1. add the matching logic about the function name
2. add test cases
2014-01-15 16:59:43 +08:00
fenzhao c850136c24 Enum support for Action and Function
Enum with type attribute with different metadata level mode
Enable Enum in FilterQueryValidator
Enum support for raw value
2014-01-14 18:47:54 +08:00
Congyong Su a08bb56452 webapi.odata: v4 work for enum in query $filter
1. Add Enum support in filter binder
2. Add support for Enum "has" operator
3. Update & enable unit tests
2014-01-14 18:25:32 +08:00
fenzhao dc7aabd157 Enum support for ODataModelBuilder, serialization and deserialization
add Enum test for SelectExpandQueryOption
2014-01-14 16:04:18 +08:00
fenzhao d42c993ef9 Enum support for ODataModelBuilder 2014-01-14 15:53:51 +08:00
Pranav K 684f70b716 Modify unobtrusive validation to only attach to forms that have
at least one input field with client validation

Work Item: 1511
2014-01-13 10:56:23 -08:00
Tian Pan 34de12c46f 193 2014-01-10 15:57:35 -08:00
Sam Xu bc54755d54 Unbound function and action
1. Follow up ODL V4 to use the IEdmActionImport and IEdmFunctionImport for
unbound action and function.
2. Unbound action and function routing is based only on attribute routing.
3. Add test cases for attribute unbound routing
2014-01-10 16:59:22 +08:00
Pranav K 6c0de66e22 Set ValidationContext.MemberName and populate ModelValidationResult witha
ValidationResult.MemberNames if available.

This change sets the MemberName property for the ValidationContext passed
to validation attributes when validating. Additionally, we set the
MemberName on the returned ModelValidationResult if the validation
result indicates the validated member is different from the model being
validated.

Work Item: 729 1534 1606
2014-01-09 15:45:36 -08:00
Ryan Nowak 62c061d6f5 Codeplex-1570 - Lazy-Initialize Dictionary on ModelMetadata
We construct very many model metadata instances for the average request,
the current code creates a dictionary for each one that's used to store
context properties. None of the framework code uses these dictionaries,
they are provided for 3rd party extensibility -- so they will likely never
be read by most users' code.

As to the safety of this change, ModelMetadata has two different uses:
1. As a long-lived object that is cached
2. As a short-lived object that is only used by a single operation, on a
single thread

For #1, any intialization of the 'AdditionalValues' collection should
occur on creation - any other writes to AdditionalValues will have bugs in
the currrent implementation.

For #2, any reads/writes to 'AdditionalValues' are part of the same
operation and will not operate on shared data.

I've also included several instances of returning a readonly 0-length
array instead of a new 0-length array. This is always safe to optimize,
and these show up as hot spots when profiling memory usage of validation.
2014-01-08 17:22:02 -08:00
Ryan Nowak 1c4e5a9846 Fix for Codeplex-1590
This change adds a ToArray call to the cached value for
GetQueryNameValuePairs, which should avoid reparses and remove a large
allocation for request-scoped memory.
2014-01-08 14:14:51 -08:00
Ryan Nowak d52221c31d Updating our package reference to Microsoft.Owin 2014-01-08 11:16:25 -08:00
Pranav K 9198909c3f MQ: Update System.Web.WebPages.Administration to use RazorGenerator
Work Item: 1477
2014-01-08 10:06:24 -08:00
Ryan Nowak 75a5487f50 Codeplex-1526 - Add support for DisplayNameAttribute to Web API
Web API was missing support for this attribute in model metadata, which
MVC has had for some time. The support here is intended to be consistent
with MVC (DisplayAttribute takes precedence).

Use it like:

public class MyModel
{
    [DisplayName("Zip Code")]
    public int HorriblePropertyName { get; set; }
}

to provided a human-readable name for a property that will be used in
validation/error messages.

You can also subclass and override the DisplayName property to support
dynamically computing text or pulling it from a resource.
2014-01-08 00:15:34 -08:00
Pranav K 1e3e68af10 Attempting to bind multiple request values to a single valued property
results in incorrect assignment

The conversion code in ValueProviderResult is duplicated from Mvc and
expects array types for request parameters with multiple values. However
WebAPI uses List<T> to represent these values. Consequently the conversion
code falls through resulting in incorrect representation.

This change updates the ValueProviderResult to expect instances of IList
which should address both array and List<T> types.

Work Item: 1563
2014-01-07 17:26:59 -08:00
N. Taylor Mullen 6035cafd93 Allow inner insertions in implicit expressions for Razor (fixes #1491).
Broke the existing IsAcceptableInsertion into two parts, a "inner" and
"end" insertion check.   An inner insertions only allows '.' insertions
within the middle of spans.   Also added 2 tests to verify correctness.
2014-01-07 14:13:39 -08:00
Pranav K 9baac11a64 Revert "MemberNames specified in CustomValidationAttribute's ValidationResult are"
This reverts commit f3138c8932.
2014-01-07 10:44:40 -08:00
Pranav K 408661f58e Adding an AllowCache option unobstrusive Ajax
This setting allows setting the cache option in jQuery Ajax (See -
http://api.jquery.com/jQuery.ajax).

Work Item: 1531
2014-01-07 10:12:29 -08:00
N. Taylor Mullen d4ed0ea0c4 Modify Razor parser to better handle intellisense commits with '.'.
Added a new accept case in the ImplicitExpressionEditHandler's
CanAcceptChange method to accept potential intermediate steps
of selecting intellisense with characters such as '.'.  Included 4 test
cases to verify functional accuracy.
2014-01-06 15:00:20 -08:00
N. Taylor Mullen ceaca890cc Remove null struct checks and improve parser in System.Web.Razor.
Optimized pieces of the BackgroundParser code path to not do duplicate
conditional checks and to not concat enumerables where it wasn't needed.
2014-01-06 11:57:01 -08:00
Ryan Nowak 0f37ba8ca9 CR feedback 2014-01-03 15:27:44 -08:00
Pranav K d191a06fa2 Json.Encode doesn't encode array properties returned from Json.Decode
Array values need to be unwrapped correctly for JavaScriptConverter to
encode it correctly.

Work Item: 1085
2013-12-31 11:13:40 -08:00
Pranav K 8fdce28acf ASP.NET MVC 3 LoadingElementDuration is not working
jQuery expects a numeric value load duration. However unobstrusive ajax
passes it the attribute value (a string type) when it is set. This
change ensures we parse the value as a decimal if it's set.

Work Item: 1520
2013-12-19 14:36:02 -08:00
dougbu 5a701f3441 Address CR comments on comments
- Also clean up VB comment syntax
2013-12-18 21:29:11 -08:00
dougbu d618b46962 Provide hooks to generate sample objects (fixes #1480)
- https://aspnetwebstack.codeplex.com/workitem/1480
- "SampleGeneration in HelpPage not working for PageResult<T>"
- General gap is support for creating complex objects lacking a parameterless
constuctor.
- Implemented approach also supports overriding data used in (say) an
ICollection<T>
- New SampleObjectFactories list extends previous ObjectGenerator.GenerateObject()
fallback and is checked after the type-specific SampleObjects property
- Avoids subclassing HelpPageSampleGenerator just to override GetSampleObject()
2013-12-18 20:53:36 -08:00
Ryan Nowak 39ce2dc499 Fix FxCop break 2013-12-18 12:52:16 -08:00
dougbu 3c305a0baa Correct use of EdmTypeCannotBeNull message (fixes #1558)
- https://aspnetwebstack.codeplex.com/workitem/1558
- "[OData] Incorrect use of EdmTypeCannotBeNull message"
- Make three uses of this resource string consistent
- PLOC issue primarily in EntityInstanceContext.GetPropertyValue() because message
mentioned "an System.Web.Http.OData.IEdmObject"
- Problem more than a PLOC issue since ODataSerializerContext.GetEdmType() would
throw NRE not intended Exception and ODataMediaTypeFormatter.GetSerializer()
would reference incorrect Type in Exception message
- Also add tests covering these sad paths (2 were missed)
2013-12-18 11:46:14 -08:00
jacalvar bcd40d2f6b Issue 1372 - ApiExplorer should add query parameters for complex FromUri
types to the RelativePath

https://aspnetwebstack.codeplex.com/workitem/1372

The scope of this fix is for complex types that have FromUri attribute on
the parameter or on the class and for which all their properties are
convertible from a string. By design, it will skip complex parameters with
properties that are not convertible from string as it's not a common
scenario and complicates the fix.

For actions that have more than one complex type that matches the criteria
above, we will emit prefixes to avoid ambiguity, in any other case, we wont.
2013-12-18 11:09:39 -08:00
Pranav K f3138c8932 MemberNames specified in CustomValidationAttribute's ValidationResult are
ignored

ValidationResult returned by a ValidationAttribute may reference one or more
member names which are currently ignored. We'll address this by
translating this as a ValidationResult for each of the members if
specified.

Work Item: 1534
2013-12-17 17:28:56 -08:00
Ryan Nowak 0bf8e5c701 Codeplex-1431 Support buffered async request stream in web host
This change allows WebAPI to use the async buffered request stream
in web host.

There are two ways to get a buffered request stream in webhost:
- GetBufferedInputStream(): is async, and buffered, but not seekable
- InputStream: is buffered and seekable, but not async

This causes a problem, because async is good... but we need seekable
streams, as we've surfaced this functionality to the user-code.

Conveniently, once you've read to the end of the GetBufferedInputStream,
it will also fully populate the buffer of InputStream. The fact that the
buffer of InputStream is fully populated means that its non-async
operations become preferrable once the buffer is finished loading, so we
have a stream that's seekable, and buffered, and we no longer care about
async at that point.

The solution is to wrap up both of these streams, so that once we've read
to the end of the 'async' stream, we start using the 'non-async' stream.
This offers the performance advantages of both cases, while preserving
seekability.

The special case we have to handle for seek is when the 'non-seekable' stream
is being used, we finish reading the end and then swap to the 'seekable'
stream. This needs to be done syncronously because of the contract for
Seek. This will only really occur in cases where user code gets the stream
and manually does seek operations instead of just reading it. Basically we
don't expect this case to be common, and it should perform about as well as it
currently does.

Katana already has a similar solution in place, and I borrowed some ideas
from them - our version is a bit simpler because we have simpler
requirements.

(cherry picked from commit addff083c4cf60c390ccb1e217fde4a369004b99)
2013-12-17 15:59:09 -08:00
Sam Xu af0a611b66 Merge branch 'master' of https://git01.codeplex.com/aspnetwebstack 2013-12-17 17:23:12 +08:00
Sam Xu f023e52699 Improve Queryable limitation 2013-12-17 17:22:04 +08:00
dougbu a912095868 Correct a couple of OData resource strings (fixes #1557)
- https://aspnetwebstack.codeplex.com/workitem/1557
- "Fix errors in OData resource strings"
- Basic PLOC issue
- Also pick up missed addition to repositories.config for new OData projects
(VS keeps insisting)
2013-12-16 15:13:18 -08:00
dougbu 4abdcb8d33 Correct typos in HelpPage.css (fixes reactivated #1479)
- Previous iteration accidentally changed selectors to match for example
sample-header elements instead of elements of that class
2013-12-13 09:21:09 -08:00
Congyong Su 8edcb16230 webapi.odata uses OData v4 libraries: phase 1
Phase 1: Use OData v4 6.0.0-alpha2 package from nuget
1. Edm Lib, ODataLib, Spatial Lib namespace changes
2. Interface / method changes, e.g.:
IEdmFunctionParameter -> IEdmOperationParameter
EdmFunctionParameterMode.In is gone
FunctionImport.AddParameter -> EdmOperation.AddParameter
IEdmFunctionBase is gone
Multiplicity  -> TargetMultiplicity
http://schemas.microsoft.com/ado/2007/08/dataservices -> http://docs.oasis-open.org/odata/ns/data
http://schemas.microsoft.com/ado/2007/08/dataservices/metadata -> http://docs.oasis-open.org/odata/ns/metadata
odata.metadata -> odata.context
3. Select&Expand syntax change
Customers&$select=ID,Orders" -> Customers(ID,Orders)
4. Collection syntax change
"propertyName" : { "results":[ 1, 2, 3 ] } -> "propertyName" : [ 1, 2, 3 ]
5. __metadata type -> odata.type
{ '__metadata' : { 'type': NS.TypeName' } -> "{ 'odata.type' : '#NS.TypeName'
6. substringof -> contains
7. edmx version from 1.0 to 4.0
8. missing key, if reading delta
9. request.Headers.Add("OData-Version", "4.0");
10. Use OData V4 Alpha2 packages from nuget.org
11. @Element -> $entity
12. "binary'0102'" -> "binary'AQI='"
12. Use EdmConstants.EdmVersion4
13. OData version from 3.0 to 4.0
14. $format: odata=minimalmetadata -> odata.metadata=minimal etc.
15. url -> odata.id
16. Migrate IEdmFunction and IEdmAction.  Action/Function change, include metadata in payload
17. Select&Expand change
18. decimal.MaxValue issue to ODataLib
19. Fix remaining test breaks:
Fix ODataEntityTypeSerializerTests, InheritanceTests
Fix ODataModelBinderProviderTest
Fix Can_DeserializePayload_InUntypedMode
Fix ReadFromStreamAsync_ReadsDataButDoesNotCloseStream:
ExpectedSampleTypeByteRepresentation
Fix CanParse_BoundFunction_AtEntity
2013-12-13 23:10:23 +08:00
Congyong Su de22e048cd Create webapi.odata projects for v4 OData
1. Copy System.Web.Http.OData to System.Web.OData
2. Copy System.Web.Http.OData.Test to System.Web.OData.Test
3. Generate new project guids
4. Set new src project InternalsVisibleTo to new test project
5. Update with latest changes from System.Web.Http.OData and the test project
6. Add 2 new projects to SkipStrongNames.xml
7. AssemblyTitle change
8. Move SuppressMessage from AssemblyInfo.cs to GlobalSuppressions.cs
9. Not change test project System.Web.OData.Test's RootNamespace (System.Web.Http) for now, since test resource files depend on it.
10. Suppress CA1704:IdentifiersShouldBeSpelledCorrectly for Unsortable.
2013-12-13 21:36:13 +08:00
dougbu 1fe1c1a57a Correct help page CSS issues (fixes #1479)
- https://aspnetwebstack.codeplex.com/workitem/1479
- "Help page font flickers on navigating to service url or help page home"
- Problems arise due to lousy HelpPage.css link placement and application of
help page styles to site banner and footer
- Scope styles in HelpPage.css to elements beneath one with the help-page
(or existing help-page-table) class
- Correct HelpPage.css style for the <body/> element to apply to the
<div id="body"/> element in all three help page views
- Move HelpPage.css link to the top of the help page views, avoiding current
placement at the bottom of the page when using application layout
- Use help-page class at top of the help page views
2013-12-12 16:07:19 -08:00
Pranav K 8a2c969ab6 Fix unobstrusive ajax to use the right context in callbacks
The request invoker in jquery.unobstrusive-ajax.js did not specify a
context. Consequently callback functions specified using AjaxOptions would
be executed in the context of the Ajax options object which is
uninteresting. Fixing this so that the context points to the triggering
element.

Work Item: 1487
2013-12-12 14:12:45 -08:00
Ryan Nowak d5188c8a75 Fix for codeplex-324 - Portable PushStreamContent throws on double dispose
An earlier change here makes the PushStreamContent call dispose on any
stream that's passed in to its SerializeToStreamAsyncMethod (only in
portable library). The comments indiciate that this is necessary because
HttpContent doesn't 'own' the stream.

When the stream is disposed, that makes it unreadable for callers, so any
type of system that tries to buffer PushStreamContent is inherently
broken. HttpContent does this by default in a variety of cases including
simply sending a message with HttpClient.

If a dispose call is really needed, it should be performed by whichever
object 'owns' the stream, and definitely not by the PushStreamContent,
which doesn't own the stream. In all the use cases I could find, the
stream is disposed by HttpContent - additionally, in all of these cases
the provided stream is a MemoryStream, which holds no native resources.

This feature is totally broken right now for portable, if there are cases
where the resource ownership model changes for portable as a result of
this fix, we should discuss those, as most scenarios with this class are
broken right now -- it can hardly get worse.
2013-12-12 11:18:02 -08:00
Ryan Nowak 827bc5075e Codeplex-777 Delta<T> can't be serialized with JSON.net
This is a partial fix for Codeplex-777, which asks that we make Delta<T>
work with the JsonSerializer.

This fix is only partial, because our implementation of GetMember and
SetMember don't perform conversions. So if you provide an int to a
property that wants a double, then it won't serialize that property. A
full fix for this requires some advanced use of JSON.Net's API and will be
published in a sample
2013-12-11 13:30:28 -08:00
phenning dfc842be5f Update MVC version number to 5.2 and fix affected tests. 2013-12-11 13:20:29 -08:00
Ryan Nowak cff6169cc7 Codeplex-1465 Allow IHttpActionResult to be used based on the dynamic
return type.

This change unifies the handling of actions with an IHttpActionResult
return type with other actions. Previously we've treating methods
declaring the return type to be IHttpActionResult (or derived) to be
treated specially.
- Only methods with IHttpActionResult return type can use
  IHttpActionResult
- Handling of HttpResponseException is different for methods with return
  type of IHttpActionResult.

These choices were intentional, but now we're reversing them based on
feedback. Now it's possible to return NotFound() or a data object, or an
HttpResponseMessage from an action method with return type of object.

This means that IHttpActionResult is checked before calling into the
action's IActionResultConverter. The documentation for
IActionResultConverter already documents this, and it doesn't really need
to be updated. The difference is that the logic is now based on dynamic
type instead of static type.
2013-12-11 13:14:00 -08:00
Yishai Galatzer 0af7cf7446 Fix CodePlex 1485
Remove empty constructors that where there for unit testing only, but where not critical for unit tests as Exception and CatchBlock are very easy to mock.
Thus removing multiple unnecessary unit tests, and unnecessary tests in the code to verify that the unit tests constructors are not called by users.
2013-12-11 13:02:47 -08:00
Pranav K 9aa310ccff CORS AttributeBasedPolicyProviderFactory provides incomplete context
We were using a unit test only constructor in
AttributeBasedPolicyProviderFactory that resulted in some of the
properties being not set for a ControllerContext.

Work Item: 1286
2013-12-11 12:08:10 -08:00
dougbu 03162ad2c2 Help page null checks for ApiParameterDescription.ParameterDescriptor properties (fixes #1484)
- https://aspnetwebstack.codeplex.com/workitem/1484
- "[HelpPage]Null ref exception when using UriPathExtensionMapping"
- Problem is more general than reported issue: NREs occur when loading help
pages whenever routes contain undeclared (i.e. unused) parameters.
- nit: Add Contract.Assert() when creating ApiParameterDescription for
declared parameters.

Known issues with optional unused parameters (aka "undeclared" though they're
declared in the route template -- just not in the action method) and those with
default values in the route configuration: These parameters will not be
included in the route template strings (eliminated deep in HttpParsedRoute.Bind())
or the URI parameter table (skipped in ApiExplorer.AddUndeclaredRouteParameters()).
These corner cases can't be fixed without breaking changes.
2013-12-11 11:28:48 -08:00
Pranav K 1eb13543f7 Add client side validation support for MaxLength attribute
- Adding an attribute adapter for the MaxLength attribute
- Unit tests for the newly added MaxLengthAttributeAdapter

Work Item: 1476
2013-12-11 11:21:57 -08:00
dougbu 456c9c968d Run [Required] validators for missing bindings (fixes #1471)
- https://aspnetwebstack.codeplex.com/workitem/1471
- "WebApi validation ignores ErrorMessage in Required Data Annotation attribute"
- Problem was specific to MutableObjectModelBinder and only visible when using
[FromUri] binding ([Required] validators are not normally special-cased)
- Update that binder to execute [Required] validators when appropriate
- Add tests for missing required property cases in ProcessDto()
- nit: Improve efficiency of HashSet of missing required properties
2013-12-10 22:28:31 -08:00
Pranav K f6d4d1b9da FormDataCollectionExtensions provides incomplete context
This problem can't be fixed; there's public surface area to model bind
this data without providing a request. For now, we'll resolve this issue
by identifying the problematic use case in in the constructor.
2013-12-10 12:06:47 -08:00
davidmatson 9e38ada175 Incorporate code review feedback. 2013-12-09 12:34:57 -08:00
Yishai Galatzer 8044bfbfc6 fix https://aspnetwebstack.codeplex.com/workitem/1472
Step II:
Rename GenerationRoute to LinkGenerationRoute
2013-12-09 12:24:22 -08:00
Yishai Galatzer 1cf5290c8a fix https://aspnetwebstack.codeplex.com/workitem/1472
Step I:
Make the properties forward to the inner route.
Explicitly block GetRouteData method , and Handler property.
2013-12-09 09:24:24 -08:00
davidmatson a194c62ef5 Create interface from DirectRouteBuilder for future extensibility. 2013-12-06 16:33:14 -08:00
davidmatson 5d1a5c5f9c Reserve the name IDirectRouteProvider for future use. 2013-12-06 16:30:26 -08:00
davidmatson 62350d4dd1 Remove outdated class diagram. 2013-12-06 12:12:39 -08:00
Pranav K c5fdac3429 Adding RazorGenerator package to Microsoft.Web.Helpers project
This allows the cshtml files to be precompiled as part of MsBuild rather
than having to do it with a VS Custom Tool

Work Item: 1477
2013-12-04 14:53:23 -08:00
raghuramn ee0c95dd25 Issue 1201: Tracing extension methods should interpret
HttpResponseException

1) GetTraceLevelAndException defaults to the callers trace level which is
incorrect. Using TraceLevel.Error as default while tracing exceptions
instead of the callers trace level.

2) minor refactoring.
2013-11-27 13:34:51 -08:00
dougbu 09ae4f6ccb Handle DBNull.Value and simple runtime types in BSON formatter (fixes #1440 & #1457)
- http://aspnetwebstack.codeplex.com/workitem/1440
- "Roundtripping DBNull value using Bsonformatter thrown an error"
- https://aspnetwebstack.codeplex.com/workitem/1457
- "Bsonformatter throws an error when passing simple types as ObjectContent"
- Switch checks for serialization as Dictionary<string, object> to use runtime type
- Special-case DBNull.Value on write (serialize empty content) in
BsonMediaTypeFormatter.WriteToStream()
- Special-case DBNull type and empty content on read (return DBNull.Value) in new
BsonMediaTypeFormatter.ReadFromStreamAsync() override

- Add unit tests for round-trips with minimal type information and with DBNull values
- Use new unit test helper for round-trip tests
2013-11-27 11:41:24 -08:00
raghuramn f6a83be072 Issue 1340: support modelbinding nonstring data from route data
Initial fix for this issue is done with commit a14733ff07 which has a
breaking change. Commit 6b64e226a has the non-breaking change but it
didn't revert the breaking change done in commit a14733ff07. This change
just reverts the inital fix (a14733ff07).
2013-11-27 10:21:08 -08:00
jacalvar 34b97826ae Issue 1384: Make ODataActionParameters work in untyped mode.
This commit is a fix on top of a previous fix that addresses
deserializing collection parameters.

The ODataActionPayloadDeserializer has been refactored to use the
ODataCollectionDeserializer internally when deserializing collection
parameters.
2013-11-27 10:15:07 -08:00
danroth27 0176e15c0f Help page UX cleanup.
Resource type should not be repeated for simple types (fixes #1461).
Show XML documentation for request body parameter (fixes #1460).
Fix font size for h3 tags.
2013-11-26 19:10:10 -08:00
raghuramn 608c3446fb Issue 1422: Validation doesn't get triggered for values extracted from
NameValuePairsValueProvider

TypeMatchModelBinder doesn't do model validation. This used to be fine in
most cases as the default value providers only support primitive value
types that require no validation. Now that ODataController supports a
valude provider that can store complex objects(ODataValueProvider), we
should do model validation in TypeMatchModelBinder as well.
2013-11-26 11:26:16 -08:00
danroth27 09a1bcf2ec Help page should not show void return types (fixes #1446). 2013-11-26 10:28:42 -08:00
dougbu ebd91cdc67 Add TemplateHelpers special case for DateTimeOffset properties (fixes #1442)
- http://aspnetwebstack.codeplex.com/workitem/1442
- "EditorFor converts DateTimeOffset property to text type instead of datetime type"
- Enable use of same default editing template for DateTimeOffset as for DateTime
- Also fill unit test gap: Confirm view names for more value types
2013-11-25 21:11:03 -08:00
shibayan a1e211da10 Fixed OutputCacheAttribute don't check value of Location property when IsChildAction is true.
This change will allows child actions to be used when a global value has
been set for the outputcache 'location'. Current we don't allow you to
customize the location on a child action - which can block the use of
child actions entirely. This change will allow you to set any of the
'non-server' cache locations on child actions.
2013-11-25 19:10:57 -08:00
Ryan Nowak 03540d8875 Fix for Codeplex-1433 Mime Multipart parser requires an extra CRLF
The Mime spec does not require the last part of the request to be
terminated with a CRLF. Our parser current requires this extra CRLF, but
we've discovered some popular tools which don't append it. This fix will
bring our parser up to spec for this case.

The end of a Mime multipart message is detected by the presense of the
'boundary' token followed by the literal '--' and then optional whitespace
and an optional CRLF.

Ex: (boundary is 'endsection' in this example)

BEGIN
--endsection
some content

--endsection
more content

--endsection--
END

So, the final line '--endsection--' may or may not be terminated with a
CRLF (newline) in a legal request.

The complication with this fix is that we require the last part of the
parse to consume the end of the input stream. It's not enough to see
'--endsection--' and declare that we've seen the end of the message, we
want to capture any text or invalid characters following the final
boundary.

In order for this to be possible, we need to reinvoke the parser with the
empty array when we run out of bytes to signal the end of the parse. This
requires some changes to validation logic to facilitate the re-entry of
the parser for this special case.

Also added a DebuggerDisplay for the parser's state to make things easier
to visualize.
2013-11-25 18:58:42 -08:00
raghuramn 9a514e49cc Fix the breaking change that c8e263 introduced
Issue 1395: MediaTypeFormatter's ReadFromStreamAsync fails when tracing is
on.
2013-11-25 15:32:19 -08:00
raghuramn 6ba576a9d8 Issue 1415: Overriding writetostreamasync taking CancellationToken do not
get invoked
2013-11-25 14:55:17 -08:00
Ryan Nowak 7136f8912a CR feedback, using full type names in error messsages about constraints 2013-11-22 12:53:14 -08:00
davidmatson 9fb684781d Use ClientDisconnectedToken on web host where reliable (fixes #858). 2013-11-22 12:09:32 -08:00
davidmatson fddc7f626d Revert ReadAsMultipartAsync disposing request stream (fixes #1444). 2013-11-22 10:02:15 -08:00
Tian Pan bb5fbdb406 Issue1419
- Now in changeHttpRouteExtensions, ToRoute() would return a HttpWebRoute
      containing a System.Web.Routing.StopRoutingHandle for the ignored route.
    - Add unit tests with constraints for IgnoreRoute on WebHost, OWIN, Self-Host.
2013-11-21 18:32:55 -08:00
danroth27 452fcf0c70 Fix build break (remove unused files). 2013-11-21 18:04:35 -08:00
davidmatson 5a5050be4d Mark old HttpMessageHandlerAdapter contsructor as obsolete (fixes #1438). 2013-11-21 17:50:44 -08:00
Tian Pan eb4d02ffc2 issue1201: Tracing extension methods should interpret HttpResponseException
- move `TranslateHttpResponseException` from `SystemDiagnosticsTraceWriter`
      to `TraceWriterExceptionMapper.cs`.
    - Both assemblies of System.Web.Http and System.Web.Http.Tracing link to
      `TraceWriterExceptionMapper.cs`, `TraceWriterExceptionMapperResources.resx`,
      and `TraceWriterExceptionMapper.Designer.cs`.
    - modify `catch` block for HttpResponseExceptions in TraceBeginEnd* methods.
    - add unit tests for each mehtod.
2013-11-21 17:42:58 -08:00
Pranav K 1f6743aa6d Throw a more specific exception when serializing null collection properties
Fixes #1328
2013-11-21 15:50:30 -08:00
danroth27 c288f9e69d Web API help page UX improvements
- Clean tabular view for all parameters
- Added URI parameters with annotations and default values
- Support for complex type URI parameters
- Added response body properties

Includes fixes for:
- https://aspnetwebstack.codeplex.com/workitem/1387
- https://aspnetwebstack.codeplex.com/workitem/1342
2013-11-21 15:42:47 -08:00
Yishai Galatzer ae5eace4c6 Add indexer support for HttpValueCollection 2013-11-21 13:45:22 -08:00
raghuramn ebcbcb07ff Add a parameterless ctor to MVC UrlHelper to improve unit testing
experience.
2013-11-21 13:37:46 -08:00
davidmatson a455de7747 Fix Inherited mark on RouteAttribute. 2013-11-21 11:52:54 -08:00
davidmatson b585ae33fb Incorporate code review feedback. 2013-11-20 16:31:49 -08:00
Ryan Nowak eb69dda15f Codeplex-1319 - Disallow {controller} and {action} in attribute routes
This change prevents the use of {controller} in all attribute routes, and
the use of {action} in attribute routes on action methods. This validation
is in place to prevent scenarios where a user takes a working traditional
route and copy-pastes it into attributes.

Use of these route parameters in the scenarios where it's now prohibited
is very very likely to be a mistake and won't do anything useful. For any
valid scenarios that are blocked by this, the workaround is to use a
different parameter name.
2013-11-20 16:02:42 -08:00
dougbu aca06c5555 Remove EditorFor HTML attribute handling inconsistencies (fixes #1434)
- https://aspnetwebstack.codeplex.com/workitem/1434
- "Remove EditorFor HTML attribute handling inconsistencies"
1. Remove special cases for collections and complex types
2. htmlAttribute renamed to htmlAttributes
2013-11-20 15:27:02 -08:00
dougbu 28c2c138b0 Add tracer wrapping DefaultHttpControllerTypeResolver (fixes 1215)
- https://aspnetwebstack.codeplex.com/workitem/1215
- "Trace exceptions in DefaultHttpControllerTypeResolver"
- Only change to DefaultHttpControllerTypeResolver public API is to make
IsControllerTypePredicate property virtual (this allows tracer override);
property remains protected

nit: Update old comments mentioning GetExportedTypes
2013-11-20 12:44:44 -08:00
Ryan Nowak 8dcaee45fb Codeplex-1400 - Prioritize action-level routes for MVC link generation
This fix solves an issue for link generation in MVC where a
controller-level route can generate links for actions that cannot be
reached through that route in mixed-routing scenarios. If the
controller-level route has a 'better' template than the action-level route
then it will always take precedence.

This change considers whether or not a route is to an action as a criteria
before considering route precedence.

There are still some scenarios here that are problematic, like when
actions
with the same name are reachable with a controller-level route and an
action-level route. It's possible to use order to override this behavior,
or to just use named routes - the goal of this change is eliminate an easy
to hit bad behavior.
2013-11-20 11:21:57 -08:00
davidmatson 3060738588 Implement cleanup correctly in OWIN middleware (fixes #1427).
OWIN does not call Dispose on middleware; instead, it signals a
host.OnAppDisposing cancellation token. Register the Web API OWIN
middleware for cleanup with that mechanism.
2013-11-19 17:04:56 -08:00
davidmatson aa25b83909 Incorporate code review feedback (fixes #1428). 2013-11-19 15:59:42 -08:00
dougbu 5003c3a8ef Preserve error message when creating CompareAttributeWrapper (fixes #1401)
- http://aspnetwebstack.codeplex.com/workitem/1401
- "CompareAttribute does not use custom error messages"
- Copy properties over in CompareAttributeWrapper constructor
2013-11-19 15:49:25 -08:00
davidmatson 5bb7558974 Incorporate code review feedback. 2013-11-19 14:32:23 -08:00
davidmatson 19bd7fe20a Incorporate code review feedback. 2013-11-19 14:31:32 -08:00
raghuramn 63611bc874 Issue 1384: Make ODataActionParameters work in untyped mode.
Adding a new type ODataUntypedActionParameters that can be used
to deserialize action payloads in untyped scenarios.
2013-11-19 13:22:02 -08:00
raghuramn fa0e890210 Issue 1425: Make MVC UrlHelper methods virtual 2013-11-19 13:18:15 -08:00
raghuramn 1927fe8cbb Issue 778: Action should support overload on derived bindable types 2013-11-19 13:13:33 -08:00
Ryan Nowak 07812eec4a Fix for Codeplex-1383 for MVC with Attribute Routing
The validation for attribute routes was missing from the earlier change.
This will validate both attribute routes and traditional routes.
2013-11-18 17:41:58 -08:00
davidmatson 65a1b9fcfb Add all route properties to RouteProviderAttribute (fixes #1426). 2013-11-18 17:34:07 -08:00
davidmatson b4038fd6de Compute Content-Length before calling buffer policy on OWIN (fixes #1424). 2013-11-18 17:32:13 -08:00
Ryan Nowak 4c30345017 Fix for Codeplex-1383 for MVC
This change adds validation to the constraints provided to MapRoute and
IgnoreRoute in MVC. This allows us to provide an error message about
invalid constraint types at startup on the common paths.

Note that MVC doesn't own the types involved (Route, RouteCollection) so
this fix is less thorough than the WebAPI version.
2013-11-18 16:57:03 -08:00
Ryan Nowak ee2dc0b313 Fix for Codeplex-1383 for WebAPI
This change attempts to block creating a route with a route constraint
that we can't handle is some common scenarios (MapRoute, Attribute
Routes).

There are still plenty of ways to create a route with invalid constraints,
and due to extensibility scenarios we can't protect against those. In
those cases there will still be an exception throw when the route is
executed.

MVC Changes to follow.
2013-11-18 16:40:33 -08:00
davidmatson b19e40013f Link buffering and chunked content on web host (fixes #1421). 2013-11-18 10:24:47 -08:00
davidmatson ee69c6bbce Return canceled task when aborting an OWIN request (fixes #1420). 2013-11-15 16:10:42 -08:00
davidmatson 430b5f3305 Disable OWIN host buffering according to buffer policy (fixes #1418). 2013-11-15 15:54:56 -08:00
davidmatson 66be22f340 Handle web host routing exceptions by default (fixes #1355). 2013-11-15 15:50:59 -08:00
davidmatson 9751c4e8ca Log and return an error when TryComputeLength throws (fixes #1320). 2013-11-15 15:09:25 -08:00
davidmatson 8da67a018a Incorporate code review feedback. 2013-11-15 13:52:52 -08:00
dougbu 0457a339e4 Correct format used when Html5DateRenderingMode==RFC3339
- http://aspnetwebstack.codeplex.com/workitem/479
- "EditorFor Date Value Does Not Output Correct Date Format As Per RFC 3339"
- Reported issue was a bug in HtmlHandler.Html5DateRenderingMode handling
- Code previously assumed any use of an edit format string indicated an
explicit [DisplayFormat] attribute
- Instead track whether edit format string came from [DataType] attribute
in new ModelMetadata.HasNonDefaultEditFormat property
- FxCop required me to refactor DataAnnotationsModelMetadataProvider slightly
2013-11-15 13:00:53 -08:00
Ryan Nowak 3c3c825aac Codeplex-1417 - Throw on ambiguous controller match in WebAPI Attribute Routing 2013-11-15 11:15:20 -08:00
phenning c6abc068ce Update Microsoft.Owin references to 2.0.2 2013-11-15 10:39:29 -08:00
Tian Pan 01376b80a3 Issue1370: WebAPI AttributeRouting RoutePrefix issue
- Add IRoutePrefix
  - Unseal RoutePrefixAttribute
2013-11-14 14:22:39 -08:00
Ryan Nowak 897b9133d8 Fix for Codeplex-1393
Disposing the HttpRouteCollection will now dispose the HttpMessageHandler
instances owned by those routes.

We want to fix this for use in scenarios where an API might have a limited
lifetime, which is possible in selfhost/owin.
2013-11-14 13:21:54 -08:00
davidmatson f291ab8258 Expose IDirectRouteProvider in MVC and Web API (fixes #1360). 2013-11-14 11:15:25 -08:00
dougbu 1efec3289b Fix 1362 & 1366; cache less to improve correctness and performance
"MVC5 Bug: Views are not compatible with Virtual Path Providers"
- https://aspnetwebstack.codeplex.com/workitem/1362
- Should never cache HostingEnvironment.VirtualPathProvider; this property
may change at any time.
- This bug is a regression from MVC4.

"MVC bug: Bad performance of views if ViewEngines.Engines is initialized
without HttpContext"
- https://aspnetwebstack.codeplex.com/workitem/1366
- ViewEngines.Engines may be read before HttpContext.Current is initialized,
leading to inefficient use of the NullViewLocationCache instance.
2013-11-13 21:21:40 -08:00
Ryan Nowak ed3bde41f5 Fixing FxCop violation 2013-11-13 12:55:33 -08:00
Ryan Nowak bd699bc92c CR feedback 2013-11-13 12:53:08 -08:00
Yishai Galatzer 8c497f9e49 Temporary fix: Disable fxcop rule MW1200, because it throws nullref. 2013-11-12 21:18:17 -08:00
dougbu 3bfb4622f4 Fix 1407, combine blank option and option label in EDDL()
- https://aspnetwebstack.codeplex.com/workitem/1407
- "EDDL() shows extra blank option in addition to option label"
- Special-case in EDDL(); don't pass option label to helper methods
- Add tests for these situations
- Add tests using an empty enum
2013-11-12 20:58:43 -08:00
Yishai Galatzer d2e43cb5dd Fix fxcop build break 2013-11-12 18:33:12 -08:00
Tian Pan 35289ec6c9 Issue 762: Support IgnoreRoute in Web API on WebHost, OWIN, and Self-Host. 2013-11-12 17:15:53 -08:00
davidmatson 39d1b2c7ce Do not treat HttpContent as containing chunked frames (fixes #1124). 2013-11-12 17:09:55 -08:00
Yishai Galatzer 96dc3442b8 Query support in portable libraries: CodePlex, https://aspnetwebstack.codeplex.com/workitem/1305
Description: Add query support in portable library,
the original support was missing because the namevaluepair
class does not exist in the portable version of .NET

This fix attempts re-use the same files and tests.
2013-11-12 16:02:46 -08:00
raghuramn c8e2630d44 Issue 1395: MediaTypeFormatter's ReadFromStreamAsync fails when tracing is
on

tracer tests that validate that the tracers override all the base class
methods do not take method overloads into account while verifying. Fixing
the test identified more issues with existing traces which are fixed as
well in this change.
2013-11-11 15:12:32 -08:00
raghuramn 24f0121f55 Issue 1409: Delta<T>.PUT overwrites navigation properties as well
Delta<T> doesn't know the IEdmType or the IEdmModel of the T. Hence
Delta<T>.Put resets the navigation properties to null as it cannot
distinguish between navigation and structural properties. This is
incorrect behavior according to OData spec and also causes issues with EF
as resetting the navigation properties might cause ForeignKey constraint
violations.

Fixing this by adding a ctor that takes the list of updatable
properties and resetting only them in Delta<T>.Put. The OData formatter
when it constructs Delta<T> during deserialization passes the structural
properties for this list.
2013-11-11 14:33:53 -08:00
raghuramn 5101edb4df Issue 1128: Web Api 2-OData same variable name causes type error 2013-11-11 13:53:23 -08:00
raghuramn b68d682b68 Issue 670: Delta<T> should support non-settable collections. 2013-11-11 10:58:38 -08:00
raghuramn 6b64e226a9 1340: support modelbinding nonstring data from route data
We discussed two solutions to this issue. Earlier commit a14733ff07 had
the wrong solution. Reverting those changes and pushing the approved fix
with this change.
2013-11-11 10:45:27 -08:00
dougbu 71dc0d422d Build break: Incorrect MessageId values in suppressions 2013-11-08 19:23:12 -08:00
dougbu 14803d6d6f Fix 1396, Provide new help page sample override, use it for BSON media type
- https://aspnetwebstack.codeplex.com/workitem/1396
- "Web API Help Pages show garbled samples if BSON formatter is enabled"
- Support HelpPageSampleGenerator with only media type; type no longer needed
- Fallback GetActionSample() lookup to use just media type as a last option
- Provide SetSampleForType() extension which also lacks type parameter
- Initialize ActionSamples to include special case for application/bson

Also use VB short-circuit logical operators where they avoid bugs.  (Not sure
And or Or are worth using except for bitwise operations but I left the rest.)

Current display in application/bson samples is a TextSample containing
"Not displaying binary application/bson content." Suggestions appreciated.

Nit: Reduce duplication between HelpPageSampleKey constructor overloads.
2013-11-08 18:40:44 -08:00
davidmatson 1a9445aa27 Run VS2013-compatible FxCop rules on VS2013. 2013-11-08 16:12:25 -08:00
dougbu 1bfee49f63 Get build working in any command window
- Prefer VS 2013 (v12.0) version of MSBuild.exe and fallback to v4.0 when necessary
- Do not rely on %Path% since that limits us to VS developer cmd windows
- Match Microsoft.Build.Tasks*.dll version to MSBuild.exe, not type of cmd window
- Have tested building in VS 2013, VS 2013 dev cmd window, and bare cmd window

Requires either a FxCopCmd.exe.config binding redirect or David's "VS2013 FxCop
compatibility" change for full VS 2013 support.
2013-11-08 16:06:26 -08:00
AMooreMicrosoft c9c33e387d DCN02: WebAPI: ParseMediaTypeHeaderValue optimization.
In all WebAPI scenarios ParseMediaTypeHeaderValue is instantiated many times per request during the negotiation process and is used inside sorting and comparison operations. The change removes the 3 heap allocations per instantiation and optimizes the CPU path. Should improve high throughput scenarios by about 1%.
2013-11-08 11:18:41 -08:00
AMooreMicrosoft 2fbe1eaa80 WA34: WebAPI: ReflectedHttpActionDescriptor: Cache repeated calls to MethodInfo.GetParameters.
In WebAPI scenarios involving paramters, there are repeated calls to extract the same set of paramters on the long lifetime ReflectedHttpActionDescriptor. This changes caches them and will prevent one array allocation per request and should improve throughput by 0.3-0.5% depending on the scenario.
2013-11-08 10:59:12 -08:00
dougbu d442ee5fd7 Merge branch 'fix1373' 2013-11-07 18:28:05 -08:00
dougbu 1ce9aecc5e CR comments on last iteration of FxCop fixes
- Back to previous MaxDepth handling
- ... but seal property overrides in BaseJsonMediaTypeFormatter subclasses
- Remove unnecessary suppressions; add a couple that were missing
2013-11-07 16:35:50 -08:00
dougbu 5ce679813f Fix 1373, Improve EDDL() Exception message in the [Flags] case
- https://aspnetwebstack.codeplex.com/workitem/1373
- "Error message is not clear when enum that has flags attribute calls EnumDropDownListFor html helper"
- Add new message for case where ModelType has a [Flags] attribute
- Provide EnumHelper.HasFlags(Type) internal method to make determination easy for EDDL()
- Leads to a duplicate call to Nullable.GetUnderlyingType(Type) but only in the failure case
2013-11-07 15:52:51 -08:00
davidmatson 168ed8227f Restore explicit attribute usages per FxCop. 2013-11-07 15:10:28 -08:00
davidmatson 9cac3aebf5 Correct route provider attribute usages (fixes #1405).
Also cleanup redundant attribute usage attributes on MVC filter overrides.
2013-11-07 14:39:06 -08:00
dougbu d778f9c0f9 Fix: Web API Help Page projects don't build in command prompt for VS2013
- $(VisualStudioVersion) has value '12.0' in this command window; copied from environment
- build.cmd consistently builds using MsBuild.exe v4
- But VS uses its native MsBuild version and this .targets file works within VS
- Guard v12 settings using $(BuildingInsideVisualStudio)
2013-11-07 12:32:49 -08:00
davidmatson 5c254517ef Add convenience property getters to exception services contexts. 2013-11-07 11:52:03 -08:00
davidmatson 865c16c32e Move CallsHandler property to ExceptionContextCatchBlock.
Whether or not an exception can be handled depends of the catch block
code, so the CallsHandler properly belongs on the catch block class
rather than varying per context on the exception logger context class.
2013-11-07 11:51:48 -08:00
davidmatson 7701713ce6 Use Content-Length for initial request buffer capacity in OWIN host. 2013-11-06 15:10:53 -08:00
davidmatson 5118a14040 Removed unused code from TaskHelpers and TaskHelpersExtensions. 2013-11-06 12:31:04 -08:00
davidmatson b8aa0e557c Improve MediaTypeFormatter use of canceled tasks. 2013-11-06 12:28:57 -08:00
davidmatson 29048b8ba0 Add RequestContext convenience property to HttpActionContext. 2013-11-06 12:27:06 -08:00
Ryan Nowak 642bb11d04 CR feedback 2013-11-06 12:00:16 -08:00
davidmatson da797e67a3 Dispose resources in web host exception cases (fixes #1345). 2013-11-06 10:52:15 -08:00
raghuramn a14733ff07 1340: support modelbinding nonstring data from route data 2013-11-05 17:51:15 -08:00
raghuramn b7f192b56c Moving Validate method to ApiController instead of ODataController 2013-11-05 16:17:08 -08:00
raghuramn a8470366b8 Issue 617: Provide overload to supply entitysetconfiguration while
defining action return type
2013-11-05 14:54:36 -08:00
raghuramn e23c166787 Issue 518: Throw error when user registers entity type as returntype
without entityset
2013-11-05 14:33:10 -08:00
dougbu b29c044ed0 Fix 1389, Fix EDDL() read from ModelState in invalid Create submission cases
- https://aspnetwebstack.codeplex.com/workitem/1389
- "EnumDropDownListFor helper throws unhandled exception when model state is invalid and create page is loaded again "
- EnumDropDownListFor() attempted to convert ModelState.Value.RawValue to general Enum type
- Fix is to use actual ModelType
2013-11-05 14:11:16 -08:00
Ryan Nowak 465a224add CR feedback 2013-11-05 13:34:34 -08:00
davidmatson 68657bee4b Support custom constraints in MVC attribute routing (fixes #1149). 2013-11-05 11:09:00 -08:00
davidmatson e6e36d1141 Refactor MVC attribute route building for further extensibility. 2013-11-05 11:06:36 -08:00
davidmatson d8cc699872 Preserve exception stack trace in ActionFilterAttribute (fixes #1316). 2013-11-05 09:24:52 -08:00
dougbu 0c27186bb7 BSON support fixup round 3: One last FxCop warning
- Ensure JSON reader gets cleaned up
2013-11-05 09:06:18 -08:00
dougbu e34d96bc22 Merge branch 'bsonCodeAnalysis' 2013-11-05 08:53:46 -08:00
dougbu cf1e0ed6d7 Address FxCop warnings that showed up in CI builds
- For e.g. http://wsr-teamcity/viewLog.html?buildId=10081&tab=buildResultsDiv&buildTypeId=bt4
2013-11-04 23:52:07 -08:00
Ryan Nowak 256968e02c Fix for codeplex-1357
This change allows users to configure the casing behavior of simple
membership provider. The simple membership provider will by default
generate a database query that normalizes the case of usernames on the
database side.

This comes with the side effect of obviating any index that the user may
have configured for the user name column.

The fix is to make this behavior configurable. With the new option, it
will be possible to turn off casing normalization, and allow the database
to handle it specific to its collation.
2013-11-04 23:30:47 -08:00
dougbu 679d450616 Correct build break in BSON support checkin
- Update PCL project files
- Correct usings to provide all necessary types
- Hack a TypeDescriptor.GetConverter(type).CanConvertFrom(typeof(string)) substitute for PCL

Nit: Remove one unused using
2013-11-04 22:18:13 -08:00
dougbu 8b1440decc Add BSON support for Json.NET MediaTypeFormatter
- https://aspnetwebstack.codeplex.com/workitem/241
- Refactor JsonMediaTypeFormatter, moving much of it into new BaseJsonMediaTypeFormatter
- All DataContractJsonSerializer support remains in JsonMediaTypeFormatter
- Add new BsonMediaTypeFormatter, another BaseJsonMediaTypeFormatter subclass
- Add (non-standard) MediaTypeConstants.ApplicationBsonMediaType
- Add Dictionary<string, T> and null test data variations -- gaps in previous formatter round-trip tests

Note BSON-specific special cases for null (empty content) and for simple
types and byte[] (Dictionary<string, object> with a single property named
"Value").  May want to publish these workarounds as well as issues with
decimal, uint, and ulong (see BsonMediaTypeFormatterTests.cs).

Nits:
- Make JsonMediaTypeFormatter comments more consistent
- Tighten JsonMediaTypeFormatter contract enforcement
- Merge adjacent #if blocks
- Correct comments referencing JsonMediaTypeFormatter

Test nits:
- Refactor MediaTypeFormatterTestBase slightly to support testing with binary serializations
- Correct value of CommonUnitTestDataSets.ValueAndRefTypeTestDataCollection and remove duplicates from tests using it
- Remove unused DataContractJsonMediaTypeFormatterTests.ValueAndRefTypeTestDataCollectionExceptULong
- Remove unecessary exclusion of TimeSpan data set in HttpAssert.CanRoundTrip(); formatters instead have trouble with DateTime (losing Kind property value)
2013-11-04 20:46:44 -08:00
Will Huang a8c44a8770 Fix MVC filter override attributes base classes (fixes #1315).
Change MVC Override*Attribute classes to derive from FilterAttribute, not
Attribute.
2013-11-04 16:46:15 -08:00
davidmatson 40854d1b7e Provide RequestContext.Url for batch requests (fixes #1301). 2013-11-04 14:12:59 -08:00
davidmatson a55ca0cee1 Use HttpActionDescriptor in attribute routing pipeline. 2013-11-04 14:10:37 -08:00
Yishai Galatzer 5122540a20 Code review feedback (use ICollection instead of IList) 2013-11-04 13:41:53 -08:00
raghuramn 3d986818a2 Issue 1358: MultipartFormDataStreamProvider.ExecutePostProcessingAsync()
doesn't get called
2013-11-04 10:56:45 -08:00
raghuramn 186370d3ce Issue 1324: Delta<T>.Patch doesn't perform validation on the entity
Adding a helper method on the ODataController to perform validation
after the delta has been applied.
2013-11-04 10:45:37 -08:00
raghuramn b45b947e21 Issue 1302: MediaTypeFormatter's WriteToStreamAsync overload taking in
CancellationToken not being invoked

HttpContent.SerializeToStreamAsync doesn't take in a CancellationToken.
So, there is no easy way to get the CancellationToken to the formatter
while writing response. We are cheating here by passing fake cancellation
tokens. We should fix this when we fix HttpContent.
2013-11-04 10:45:35 -08:00
raghuramn aee843f398 Issue 1041: parse errors in OData $filter and $orderby are not sent back
to the client properly
2013-11-04 10:45:33 -08:00
davidmatson 644744b7a5 Parallelize code for creating attribute routes in MVC and Web API. 2013-11-01 15:27:02 -07:00
Ryan Nowak 36200c595c Fixing an FxCop break 2013-11-01 13:17:39 -07:00
Ryan Nowak e17c97d41a Codeplex-1163 - Improved error message for duplicate named attribute
routes.

Duplicate names for traditional routes already give a good error message,
which explains that you can't do that, and what the duplicate name is.
Prior to this change duplicate names on attribute routes would fail with a
generic 'duplicate key' message without telling you the key.
2013-10-31 14:21:10 -07:00