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

1777 Коммитов

Автор SHA1 Сообщение Дата
fenzhao 992d10eacc Issue 1941: Parameters Property of SingleEntityFunctionCallNode should
never be null
It is fixed in ODL 6.4
https://aspnetwebstack.codeplex.com/workitem/1941
2014-07-04 16:05:27 +08:00
fenzhao 142f4ff7fc Issue 1594: DefaultODataBatchHandler doesn't handle urls relative to the
batch endpoint properly.
The root cause is that the base uri of ODataMessageReaderSettings doesn't
end with slash.
The fix is only for v3 and v4 works well for all kinds of urls because
ODL v4 will append a slash in the end of the base uri if there isn't one.
2014-07-04 15:45:58 +08:00
Sam Xu 6c5cc2cdb6 [Codeplex #1985]: Make the internal constructor as public in
BoundActionPathSegment
2014-07-03 10:29:34 +08:00
Ryan Nowak cc09dca081 Fix for codeplex #1996 - Nullref on 404 with webapi batching
The issue here is that one of the requests in a batch was matched by an
MVC route when running in web host.

The batch handler uses HttpServer to invoke the individual requests.
Internally the HttpServer forwards the request to an
HttpRoutingDispatcher.

In the web host case, the HttpRoutingDispatcher has a reference to
HostedHttpRouteCollection - which is implemented by matching BOTH WebAPI
and MVC (System.Web) routes. If an MVC route matches, then the produced
IHttpRouteData instance doesn't have its .Route property set as the
underlying route that matched does not implement IHttpRoute.

This causes attribute routing in the controller selector to fail, as we
did not anticipate this case.

Followup filed to consider whether or not this is the right behavior for
the dispatcher/route-collection.

(cherry picked from commit f9a064cbf2)
2014-06-20 14:00:57 -07:00
Ryan Nowak f9a064cbf2 Fix for codeplex #1996 - Nullref on 404 with webapi batching
The issue here is that one of the requests in a batch was matched by an
MVC route when running in web host.

The batch handler uses HttpServer to invoke the individual requests.
Internally the HttpServer forwards the request to an
HttpRoutingDispatcher.

In the web host case, the HttpRoutingDispatcher has a reference to
HostedHttpRouteCollection - which is implemented by matching BOTH WebAPI
and MVC (System.Web) routes. If an MVC route matches, then the produced
IHttpRouteData instance doesn't have its .Route property set as the
underlying route that matched does not implement IHttpRoute.

This causes attribute routing in the controller selector to fail, as we
did not anticipate this case.

Followup filed to consider whether or not this is the right behavior for
the dispatcher/route-collection.
2014-06-20 13:55:11 -07:00
Sam Xu a3cfbbeee0 [Codeplex #1853]: Delete TransientFunction and TransientAction
Summary of this changeset:

1. Remove the TransientFunction and TransientAction functions
2. Remove the IsAlwaysBindable, AlwaysBindable
2014-06-19 10:05:27 +08:00
Sam Xu 476fdc1b74 [Codeplex #1853]: Delete TransientFunction and TransientAction
Summary of this changeset:

1. Remove the TransientFunction and TransientAction functions
2. Remove the IsAlwaysBindable, AlwaysBindable
2014-06-18 15:46:50 +08:00
Congyong Su 7710a52abc Fix 1998 : OData-EntityId header not returned for 204 Patch Responses
If client sends a request with Prefer: return=minimal, and then service
may return an http status code 204 without response content, and also add
a response header OData-EntityId.
"if the service applies a return=minimal preference. In this case, the
response body MUST be empty."

Change Prefer return parameter to: return=representation, and return=minimal
For a response to a create (post/patch/put) operation, add OData-EntityId header,
if response is with status code: NoContent
2014-06-07 12:07:24 +08:00
fenzhao 2e77d3a184 [Codeplex #1973] The context url in the response from a composable
function followed by a property is incorrect.
2014-06-07 11:34:12 +08:00
Congyong Su 566ba41ef1 Fix 1865 : The containing entity is missing in the response header
Location of creating a contained entity.
Fix 1969 : For containment, GenerateLocationHeader() return the wrong URI
2014-06-07 11:05:42 +08:00
fenzhao 47276a9385 [RTM]Issue 1993: OData batch request fails when there are more than 9 entities 2014-06-07 09:10:22 +08:00
jacalvar 39a818802c Fix build break
Added SupressMessage to EdmModelHelperMethods in System.Web.OData.
2014-06-06 13:59:39 -07:00
Sam Xu a3a7e144c6 [Codeplex #1898]: Clean up the ODataMetadataLevel.Default
[Codeplex #1900]: ODataMediaTypes.GetMetadataLevel()` calculates incorrect
default metadata level

Summary of this fix:
1. clean the ODataMetaDataLevel.Default
2. Calculate the correct metadata level
3. fix the corresponding test cases
2014-06-06 16:26:44 +08:00
Sam Xu c7f3407c89 [Codeplex #1840]: Bound Action/Function should return the correct
navigation source

1.If the user defines the return type of action/function by calling
"ReturnsEntityViaEntitySetPath<T>(entitySetPath)", we will call
"TryGetRelativeEntitySetPath(...) to get the target navigation source.

2.If the user defines the return type and the returned navigation source by
calling "ReturnFromEntitySet<T>(entitysetName)", we will define an
instance of "ReturnedEntitySetAnnotation" with the entity set name and set
it as an annotation in the Edm Model. When we dispose the action/function
call, we will get the annotation from the model and use the entity set
name in the annotation to find the target navigation source.
2014-06-05 14:28:02 +08:00
Pranav K 7303170426 RazorParser.Parse method recurses infinitely 2014-06-04 12:21:26 -07:00
N. Taylor Mullen b700c475e4 Modify Facebook hook API to be more like filters.
- Modify tests to account for new behavior.
- Only trigger one Facebook prompt hook per request.
- Expose new ShowPromptResult and JavaScriptRedirectResult.
2014-06-04 12:15:30 -07:00
Tian Pan 13dfa35fe7 [RTM] Fix 1977: Help page references wrong version of MVC host. 2014-06-02 15:06:04 -07:00
N. Taylor Mullen e6dab7ccc1 Remove application start code. 2014-05-30 14:30:31 -07:00
Congyong Su 4c5f054be3 Fix 1937 : Expanded navigation properties should be properly represented
on the response payload

Serialize null single valued navigation property as null in payload.
Serialize null collection valued navigation property as empty collection
in payload.  Previously, they were not serialized, i.e., missing in
payload.
2014-05-30 17:42:55 +08:00
Sam Xu 977bff52ec Migrate To ODL 6.4 2014-05-30 14:42:38 +08:00
Congyong Su 4edbceb662 Fix 1691 : OData v4 Serialization Perf is 10% slower than v3
Based on profiling, found out that if an OData route prefix is null, the
existing ODataRoute.GetVirtualPath method does not call
GenerateLinkDirectly to generate an optimized direct link, instead
base.GetVirtualPath is invoked.
2014-05-30 10:32:57 +08:00
Congyong Su d252143d7e Fix 1571 : Custom OData Actions do not respect 204 return values
Fixed the null reference exception happens on
response.Content.GetType().FullName
Fix for both v3 and v4.
2014-05-30 09:01:22 +08:00
Sam Xu 6c741f7bfa [Codepelx #1938]: ConventionRouting does not support PUT/PATCH to a single-valued navigation property
Add the support *PUT/PATCH* to a single-valued navigation property in
convention routing. But, it is not valid to *Put/Patch" to any collection-valued navigation property.
2014-05-29 11:13:42 +08:00
fenzhao 25c1095f67 [RTM] Issue 1678: We should check for navigability when parsing the OData path 2014-05-29 11:01:14 +08:00
fenzhao c5ff1cf29e [RTM] Issue 1948: bad query string return 500 instead of 400
The root cause is that we catch ODataException only to create error
response, however NotImplementedException, NotSupportedException and
InvalidOperationException may throw for bad query string.
We need to catch all these exceptions to create error response.
2014-05-29 10:27:15 +08:00
fenzhao 4085045947 [RTM] Issue 1947: Cannot include general delimiters in string literals 2014-05-29 09:55:32 +08:00
Sam Xu 13c8adbd83 [Codeplex #1928]: We should not map derived type when building Edm Model.
This fix is not mapping derived types because it will break all the query
composition scenarios.
In this fix, I improve the error message to make
the message actionable and give out the workaround.
2014-05-28 10:09:00 +08:00
fenzhao 8806ffba08 [RTM] Issue 1799: ODataConventionModelBuilder should not add properties defined in base CLR type 2014-05-28 09:47:40 +08:00
dougbu 2c160ea866 Fix 1858: Make public OData annotations immutable
- only one setter was used in a test
2014-05-16 20:55:25 -07:00
N. Taylor Mullen 23b491a241 Add version specific info for new facebook package name. 2014-05-16 19:34:13 -07:00
N. Taylor Mullen ba644b54dc Update dll/namespace of Microsoft.AspNet.Mvc.Facebook.
Changed it to Microsoft.AspNet.Facebook.
2014-05-16 19:34:10 -07:00
dougbu b98a9eccc9 CR comments
- change code comments as suggested
- also address Stylecop issue in test file
2014-05-15 20:54:53 -07:00
dougbu f5c29a64b7 Fix 1907, ODataPathRouteConstraint.Match cannot get correct serviceRoot
- route values are not configured when constraints execute during URI
  resolution; that configuration occurs after all constraints are done
- this causes the UrlHelper to incorrectly calculate the service root,
  expecially when the OData route prefix contains parameters
- in addition ODataPathRouteConstraint should not use UrlHelper since
  constraints operate at a much lower abstraction level
- use RequestUri and route values directly to determine service root

Also fixes #1916, which relates to not using the application base
- that fix comes from different approach taken here

Require that ODataPath be in the RequestUri
- ODataRoute's template ensures this is true
- basically remove a special case from the product code
- fix the tests which required the special case

Revise ODataPath matching to provide ODL with escaped service root
- necessary to avoid incorrect escaping and unrelated links in responses
- add lower-level unit tests of ODataPathRouteConstraint

Handle corner case in `ODataPathRouteConstraint`
- an escaped slash may separate OData path from app base / virtual path
  root / OData prefix before it
- but ODL and `DefaultODataPathHandler` expect a literal '/'
2014-05-15 20:54:49 -07:00
dougbu 18c3a489a7 Revert fix for "1907: ODataPathRouteConstraint.Match cannot get correct serviceRoot"
- leave newly-added test of a problematic scenario

This reverts part of commit 9ac000ebd1.
2014-05-15 20:54:45 -07:00
Sam Xu 441a168649 [Codeplex #1917]: User friendly message should be displayed if user requests service document with accept:application/xml
[Codeplex #1939]: Should do some clean up in ODataMediaTypeFormatters.CreateApplicationXml

codeplex #1917 only mentions to clean up the service document in
application/xml. But, as a fact, ODL only supports Metadata document in
application/xml format. For other payload kinds  (for example, Property, EntityReferenceLink(s), Collection, Error)  are not supported any more as application/xml format in ODL.

codeplex #1939 is required to clean up all other not-supported payload kinds from application/xml format. The requirement is similar with the above and the fix is same.
So, this changeset merges them together. Thanks.
2014-05-16 10:02:57 +08:00
Congyong Su f73f9a6a87 Fix 1748 : OData V4 client unable to parse OData V4 service generated batch response 2014-05-15 17:26:26 -07:00
N. Taylor Mullen 170e5514e2 Updated Facebook package.
Also after evaluating how we utilize FacebookClient's clarified a comment on it's use.
2014-05-15 16:05:37 -07:00
N. Taylor Mullen 67ce0124f6 Remove requirement for permissions on redirect model binder.
Previously if a user wanted to only have default user permissions (which we support) the app would explode on redirects due to the model binder ensuring permissions existed.
2014-05-15 16:03:53 -07:00
N. Taylor Mullen ed8a289eef Modify FacebookAuthorizeFilter flow & add hooks.
Added a PrePermissionPromptHook, a DeniedPermissionPromptHook and added the infrastructure to support custom ActionResult responses from them in order to fully control the Facebook app login flow.  Also added a new method to IFacebookPermissionService to utilize externally and internally for getting a users permission status.
2014-05-15 16:01:55 -07:00
Congyong Su f30cea57ca Fix 1924 : Enable OData attribute routing by default
Fix 1946 : Remove MapODataRouteAttributes api

Add a new api CreateDefaultWithAttributeRouting in ODataRoutingConventions
2014-05-14 22:42:02 -07:00
fenzhao 18eb1208b7 Add parameter alias support for the following node in ParameterAliasNodeTranslator
1. Source of CollectionFunctionCallNode
2. Source of CollectionNavigationNode
3. Source of CollectionOpenPropertyAccessNode
4. Source of CollectionPropertyAccessNode
5. Source of CollectionPropertyCastNode
6. Source of EntityCollectionCastNode
7. Source of EntityCollectionFunctionCallNode
8. Source of SingleEntityCastNode
9. Source of SingleEntityFunctionCallNode
10. Source of SingleNavigationNode
11. Source of SingleValueCastNode
12. Source of SingleValueFunctionCallNode
13. Source of SingleValueOpenPropertyAccessNode
14. Source of SingleValuePropertyAccessNode
2014-05-15 08:57:54 +08:00
Pranav K 09a89d394b Setting context on jquery unobtrusive does not fire ajaxComplete events 2014-05-13 17:16:46 -07:00
Tian Pan 8f13dbe7e8 Fix 1878: Support other message wrappers in `ValidationMessage()`. 2014-05-13 15:40:39 -07:00
Congyong Su 933e9f6578 Fix 1722 : $batch response code should be 200, instead of 202 2014-05-12 11:07:34 +08:00
Sam Xu 4a7ecb336c [Codeplex Issue #1841] Forbid posting a singleton from navigation link
If a navigation source has a navigation property which is binding to a
single-valued object or non-collection valued object, then *post to* this
navigation property is not allowed.
2014-05-12 09:41:00 +08:00
fenzhao 89f9f86196 Add test cases for ParameterAliasNodeTranslator 2014-05-12 09:26:41 +08:00
Ryan Nowak 8d67d42117 Fix for codeplex 1612
Support for absolute or relative URLs in CreateFix for codeplex 1612
2014-05-09 14:18:16 -07:00
davidmatson d924f3d6cf Prefer IReadOnlyList to IReadOnlyCollection in new APIs. 2014-05-09 11:31:43 -07:00
fenzhao 3c99828780 issue 1843: The context URL for a property request is not right.
The root cause is that the ODL path of ODataMessageWriterSettings is not
set correctly.
2014-05-09 22:56:53 +08:00
Congyong Su 596e538edb Fix 1915 : Remove the unnecessary overload from HasEditId and HasReadLink
Remove the string overload of HasEditLink, HasReadLink:
A link has to be a Uri as per OData spec.
The string overload is only referenced by a test method.
2014-05-08 12:00:20 +08:00
jacalvar a68b154808 Issue 1749 - OData V4 service do not properly handle invalid
OData-Version header values (V3 version)
https://aspnetwebstack.codeplex.com/workitem/1749

This fix adds a version constraint to the ODataRoute that will prevent
it from matching any request with a v4 version header or a request with
a v1-v3 version header whose value is outside of the range of this
constraint. The default range for the constraint is 1.0 to 3.0, but this
can be changed by removing the constraint and adding a different one
with a different range. This constraint will still match any request
without version headers.
2014-05-07 15:01:00 -07:00
jacalvar d0c0162ab8 Issue 1749 - OData V4 service do not properly handle invalid
OData-Version header values (V4 version)
https://aspnetwebstack.codeplex.com/workitem/1749

This fix adds a version constraint to the ODataRoute that will prevent
it from matching any request with a v3 version header or a request
with a v4 version header whose value is different than 4.0.
This constraint will still match any request without version headers.

Conflicts:
	test/System.Web.OData.Test/HttpRouteCollectionExtensionsTest.cs
2014-05-07 13:50:23 -07:00
jacalvar 6ae0ac74bf Issue 1718 - System.ArgumentNullException is thrown if a raw value of null
is requested.
https://aspnetwebstack.codeplex.com/workitem/1718

This change fixes the broader problem by handling null values in general,
not just for raw values. We replaced ODataNullValueAttribute with
ODataNullValueMessageHandler. This message handler will convert null
requests for individual entities or singletons into 404 responses and
will convert null requests for non collection properties (navigation
or structural) into 204 responses. This behaviour is not enabled by
default. The user needs to plug in the message handler as a per route
handler when he registers the OData route.
2014-05-07 13:09:07 -07:00
jacalvar 84c45e064d Issue 1711 [Part2] - When returning an Entity that contains an ETag
annotation, the ETag header should also be set.
https://aspnetwebstack.codeplex.com/workitem/1711

Created a specific MapODataServiceRoute overload to make registering
per route HttpMessageHandlers in OData routes easier.
2014-05-07 13:09:05 -07:00
jacalvar f3c840b01d Issue 1711 [Part 1] - When returning an Entity that contains an ETag
annotation, the ETag header should also be set.
https://aspnetwebstack.codeplex.com/workitem/1711

Created an ODataETagMessageHandler to take care of calculating and
adding the ETag Header to the response when it's a successful response
that returns a single resource with an ETag defined and the response
status code is different than NoContent.
2014-05-07 13:09:02 -07:00
jacalvar b75500e8d0 Issue 1753 - OData V4 service should not support DateTime
Added more guards to protect against mapping DateTime accidentally when
using the convention model builder.
2014-05-06 14:23:15 -07:00
dougbu 1eb185277f Remove trailing whitespace introduced in previous commit 2014-05-06 11:44:28 -07:00
fenzhao 9b2e2ed6f3 Support $filter and $orderby with ODL parser 2014-05-06 11:42:38 -07:00
fenzhao 9ac000ebd1 1907: ODataPathRouteConstraint.Match cannot get correct serviceRoot
This will fix IIS error on test branch.
2014-05-06 11:27:36 +08:00
Congyong Su 63b8c911c4 Fix 1839 : Add support to Requesting Entity References 2014-05-06 08:51:57 +08:00
Pranav K 8dd74d2a69 Adding support for overriding unobtrusive validation defaults
Work Item: 1502
2014-05-05 09:59:18 -07:00
fenzhao 278a82b978 support dollar id to specify the key of reference of entities 2014-05-05 10:04:44 +08:00
fenzhao 0ea58af2ac port to ODL parser to parse path and template 2014-05-05 09:48:25 +08:00
Sam Xu a6d00bf35d [Codeplex #1904]: Migrate to ODL V6.3
ODL 6.3 is released and available on nuget along with the source code.
Here is the change summary of ODL in this release:
1. Fix a bug for serializing floating-point values to NaN, INF, and -INF.
2. EdmLib & ODataLib now supports model reference.
3. ODataLib now supports reading and writing delta response.
4. EdmxReader supports ignoring the unknown attribute/element in new
TryParse API.
5. ODataUriParser adds support for parsing relative Uri without service
root

So, The summary in this migration is:
1. Update to ODL V6.3 package
2. Fix the test cases.
2014-05-04 10:05:02 +08:00
Sam Xu 5e30c377e1 [Codeplex #1743]: Remove ATOM Support in WebAPI V4
Remove ATOM support in WebAPI V4 owing that ATOM is not in OData V4
standard currently and it is not fully support in OData V4.
2014-05-04 09:45:11 +08:00
jacalvar 0104bf8745 Issue 1810 - V3 fix ODataProperties().Version should be calculated according to
the spec. https://aspnetwebstack.codeplex.com/workitem/1810

The actual issue is that the version that was being calculated is the one for the
response and the codeplex issue describes the algorithm that calculates the request
version.

This change refactors the current v4 implementation for calculating the response by
moving the constants for the version headers to HttpRequestMessageProperties,
defining separate internal properties for the values of the OData-Version and
OData-MaxVersion and moving the logic for calculating the version to use in the
response to the ODataMediaTypeFormatter.
2014-05-02 17:53:44 -07:00
jacalvar b2df7250ee Issue 1810 - V4 fix ODataProperties().Version should be calculated according to
the spec. https://aspnetwebstack.codeplex.com/workitem/1810

The actual issue is that the version that was being calculated is the one for the
response and the codeplex issue describes the algorithm that calculates the request
version.

This change refactors the current v4 implementation for calculating the response by
moving the constants for the version headers to HttpRequestMessageProperties,
defining separate internal properties for the values of the OData-Version and
OData-MaxVersion and moving the logic for calculating the version to use in the
response to the ODataMediaTypeFormatter.
2014-05-02 17:39:16 -07:00
jacalvar afa7236163 Issue 1751 and 1741: Setting odata.metadata ContentType.Charset in OData responses
Issue 1751: OData V4 Responses MUST include the odata.metadata parameter(odata.metadata=full,
odata.metadata=minimal or odata.metadata=none) to specify the amount of metadata
included in the response in V4
https://aspnetwebstack.codeplex.com/workitem/1751

Issue 1741: Charset parameter should not show in Content-Type in response if Accept in request
don't has it

Rewrote SetDefaultContentHeaders in ODataMediaTypeFormatter to fix both issues.
2014-05-02 17:20:49 -07:00
jacalvar 8709d5c222 Issue 1768 - OData V4 requires disabling ProxyCreation in EF
https://aspnetwebstack.codeplex.com/workitem/1768

Reverted a change that made the internal cache of EdmStructuredObject
use a tuple of the property name and the IEdmStructruredType instead
of a tuple of the property name and the object type as the key for the
cache.

The issue was caused because the GetOrCreatePropertyGetter method
incorrectly cached a getter delegate using the EF dynamic proxy and
later on it tried to use that same getter with the actual type, which
resulted on a cast exception.

Reverting the cache to use the type instead of the IEdmStructuredType
will solve that problem as each type will have it's own getter. This is
also the behaviour the system exposed before model aliasing was
introduced.
2014-05-02 08:06:56 -07:00
jacalvar 3ab3820639 Issue 1752 - OData V4 Routes.MapODataRouteAttributes throws the null reference
exception without EnsureInitialized.
https://aspnetwebstack.codeplex.com/workitem/1752

This fix changes the behavior to be the same exposed by Web API, which is
throwing an InvalidOperationException with the same error message as in Web API.
2014-05-01 15:40:56 -07:00
Tian Pan 0960a69953 Revert "Fix 222: Route specific message handlers are not getting traced."
This reverts commit e4b7b86a6c.
2014-05-01 11:29:48 -07:00
fenzhao 3e6575639d fix 1867: The parameter of enum type in bound function does not work. 2014-04-30 09:51:22 +08:00
Sam Xu c7a00eae82 [Codeplex Issue #1782]: Suppress key convention once [Key] explicitly
apply at *any* properties.

In OData Convention Model Builder, it will the property
that is annotated with the Key attribute and follows the "schema Id |
TypeName + Id".

We should suppress the convention rule if any properties were annotated
with [key].

Here is the example which can illustrate this modification:

Suppose we have the CLR type as:
=========================================
public class Customer
{
[Key]
public string Path { get; set; }
public long CustomerId { get; set; }
...
}

Then, we use OData Convention Model builder to build the EdmModel:
=========================================
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<Customer>("Customers");
....
builder.GetEdmModel();

In $metadata, there are two keys existed:
=========================================
<EntityType Name="Customer">
<Key>
<PropertyRef Name="CustomerId" />
<PropertyRef Name="Path" />
</Key>
<Property Name="Path" Type="Edm.String" Nullable="false" />
<Property Name="CustomerId" Type="Edm.Int64" Nullable="false" />

Originally, User is explicitly decorated [Path] as the key, so, the
[CustomerId] shouldn't treat as key. So, this modification will suppress key
convention once [Key] explicitly apply at *any* properties.
2014-04-30 09:37:58 +08:00
Ryan Nowak 72d1d55ae4 Do not treat canceled tasks as unhandled exceptions (fixes #1789). 2014-04-29 11:59:08 -07:00
Ryan Nowak a2fe4a2bd3 Adding IDirectRouteProvider for MVC 2014-04-29 11:43:16 -07:00
jacalvar bffa777419 Issue 1753 - OData V4 service should not support DateTime.
https://aspnetwebstack.codeplex.com/workitem/1753

StructuralTypeConfiguration.AddProperty now throws when the user tries
to add a property of type DateTime.
2014-04-25 12:29:50 -07:00
jacalvar d7afc7a6cd Issue 1756 - options.IfMatch.ApplyTo and options.IfNoneMatch.ApplyTo should
return IQueryable<T> instead of IQueryable.
https://aspnetwebstack.codeplex.com/workitem/1756

Added a generic overload on Etag<T> (The type of the IfMatch and IfNoneMatch
properties on ODataQueryOptions<T>).
2014-04-25 10:29:12 -07:00
Ryan Nowak ec06c2ae49 Merge branch 'codeplex-1797' 2014-04-24 15:37:25 -07:00
Ryan Nowak 95b471ec23 Do not cause unhandled exceptions for canceled tasks (fixes #1797).
HttpTaskAsyncHandler should not ever exceptions except in the case
of a really unfixable error. This change will call request.Abort() and
terminate gracefully instead of reporting an error.

issue-#1789 must also be fixed for this to handle all cases. Right now
this can only handle cases where we fail deep in infrastructure methods.
2014-04-24 15:36:12 -07:00
dougbu 19e78f732f Add scoped `ViewContext.ValidationSummaryMessageElement`
- provides default top-level element when not overridden in
  `ValidationSummary()` calls
- also HtmlHelper access to ValidationSummaryMessageElement setting
2014-04-24 09:19:24 -07:00
Andy Butland 6119dc79c0 Amend validation summary method overrides to use named parameters 2014-04-24 09:17:35 -07:00
Andy Butland 21c99c6f13 Add additional parameter to ValidationSummary extension methods that allow the supply of an HTML tag to use for the summary heading, for improved accessibility 2014-04-24 09:17:33 -07:00
unknown 30a33648d7 [Codeplex Feature #1787]: Support open complex type for WebApi
This feature is to support open complex type in WebAPI.
Open Complex Type is a complex type with declared and dynamic properties.

The user can use IDictionary<string, object> to define a property in his
complex type (CLR class), then the WebApi model builder can build this
complex type as open complex type. The end user can post their dynamic
properties for this open complex type to the service in the payload, then
he can get their dynamic properties from the service in the future to do
futher process.
2014-04-24 14:36:16 +08:00
Pranav K 22c7da8986 Modify unobtrusive ajax to use element instead of passed in context for
callback functions
Work Item: 1702 1506
2014-04-23 10:13:51 -07:00
Pranav K 37636a7032 Adding support for "replace-with" InsertMode to jquery unobtrusive ajax
The Replace option currently available in AjaxOption replaces the contents
but not the element itself. The newly introduced ReplaceWith option
matches the replaceWith semantics of jQuery.

Work Item: 1500
2014-04-23 09:50:19 -07:00
Tian Pan e4b7b86a6c Fix 222: Route specific message handlers are not getting traced. 2014-04-22 19:40:17 -07:00
Tian Pan 2764353b8e Fix 1820: Need a way to support disable <option> or <optgroup> using SelectList. 2014-04-22 12:41:03 -07:00
Tian Pan a195b5b710 Fix 1760: Make MultipartFormDataStreamProvider easier to work with non-FileStreams. 2014-04-22 10:45:01 -07:00
Ryan Nowak 32e2cfb73b Fix for Codeplex-1781 ControllerContext not set in exception
handling/logging

The issue here is that when an action (or ApiController infrastucture)
throws an exception, it might be handled along one of two code paths
depending on whether or not any exception filters are configured.

If any exception filters are present, the logging/handling will take
place inside the 'IExceptionFilters' block. Otherwise logging/handling
will take place inside the 'HttpControllerDispatcher' block.

The 'IExceptionFilters' block would correctly provide a ControllerContext,
and the 'HttpControllerDispatcher' block did not.

The fix is to, when possible, provide a ControllerContext in the
'HttpControllerDispatcher' catch block. Note that it is only possible to
provide a ControllerContext when an exception was thrown the controller or
action itself. If an exception is thrown during controller selection or
controller activation, there is no context, and thus none provided.
2014-04-22 10:37:19 -07:00
fenzhao 1ae89ae603 1704: Delete ContainerQualifiedName in ProcedureConfiguration 2014-04-22 10:26:25 +08:00
Yishai Galatzer 48285655ae https://aspnetwebstack.codeplex.com/workitem/1762
Registration for disposal happened too late.

Registration was moved up the callstack and now preflight calls dispose correctly.
2014-04-21 13:59:06 -07:00
Pranav K 56a9d42334 Query the BuildManager for file existence when it cannot be located on
disk

When dealing with precompiled 'non-updateable' applications, deleting
marker files was allowed in earlier iterations of Mvc. This change
restores this behavior.

Work Item: 1709
2014-04-21 11:21:47 -07:00
Yishai Galatzer c38bff24e9 Fix Codeplex issue #1838
https://aspnetwebstack.codeplex.com/workitem/1838

Improve error message for the following case:
    @if (true)
    {
       <script> var a= '<script></script>' </script>
    }

The user code is wrong, and the script will be broken.
The browser will terminate the script at the first </script> inside
the string but will not report an error.

Razor catches it correctly, but the error message does not provide
enough clues to what went wrong.
2014-04-18 12:49:18 -07:00
sornaks 21015f6ac1 BUG 1589: JQueryMvcFormUrlEncodedFormatter use wrong HttpConfiguration
Changes to support passing the original config in JQueryMVCFormUrlEncodedFormatter

Move Make HttpConfiguration constructor pass the
configuration into the JQueryMVCFOrUrlEncodedFormatter constructor and then pass it down to the FormDataCollectionExtensions.

Wrap the Configuration's Services to return only the necessary Services when ReadAs is called.

Adding Unit Tests.
2014-04-18 10:22:29 -07:00
Congyong Su e4a0d36637 Task #1778 : Containment support to webapi.odata
1. Able to build an Edm model has a contained navigation property, using
convention model builder
  Add a [Contained] attribute to mark a navigation property as containment.
2. Able to build a model has a contained navigation property, using model
builder
  EntityTypeConfiguration<T>: ContainsMany, ContainsRequired,
ContainsOptional
  These, and existing HasMany etc. can be used to override convention model
builder.
3. Able to build a model with a base type has a contained navigation
property, and the navigation property is inherited by a derived type,
using model builder and convention model builder.
4. Able to route for fundamental scenarios
  ../MyOrders(orderId)/OrdersLines
  ../MyOrders(orderId)/OrdersLines(lineId)
5. Able to serialize / des-serialize containment
6. Containment in expand
7. Calculate links via ODL
  In derived scenario, when generate ID link (should be a Uri as per spec,
instead of string,) we should not append type cast at the end.
  Previously, when webapi.odata generates an Id link, it will check if a
derived type has a nav prop, if yes, it will append a type cast (even if
the actual type is the same to the request one.)
  After we leverage ODL for edit link generation, the edit link will be:
./service_root/es(key)/cast/cast
  As per v4 spec, the editlink/readlink does include the type-cast; however,
according to convention the Id does NOT include the type-cast:
8. Fix test cases about editLink
9. Verify containment after composable function / action
2014-04-18 23:15:04 +08:00
sornaks 11e4c560b9 Introducing a new ValueProviderFactory to handle JQuery inputs. Introducing Lazy loading for initializing NameValueCollectionValueProvider data. Moving away from Lazy<T> 2014-04-17 16:27:08 -07:00
Ryan Nowak df39629e6c Adding phone 8.1 support for formatting 2014-04-17 14:01:34 -07:00
fenzhao d4cb4a90d0 add cast support in query option for primitive/enumeration types 2014-04-11 14:20:06 +08:00
Sam Xu c0a8e8914e [Codeplex taks #1776] Support Singleton feature
Singleton is the new concept in OData V4. The meaning of it is to allow
user to create a special (unique) entity and such entity can be addressed
directly by its name. The behaviour of Singleton is very similar with
the behaviour of entity set but has different meanings.

Here is the scope of singleton feature:

1. Support Singleton configuration
2. Support Singleton manipulation on ODataModelBuilder
3. Support Singleton manipulation on ODataConventionModelBuilder
4. Support Singleton convention routing & attribute routing
5. Support Singleton serialization / dieselization
6. Support Singleton query option
7. Support Singleton navigation property
8. Support Singleton in Service document
9. Support Singleton action and function
2014-04-10 13:42:05 +08:00
Sam Xu 7597205f4a [Codeplex Task #1825] Migrate to ODL V6.2
The summary of migrating to latest ODL V6.2 from ODL V6.0 beta 1 :

1. Use ODL v6.2 RTM assemblies.
2. In ODataError, MessageLanguage is gone.
3. EnumNode is gone.
4. ElementType is gone -> EntityType().
5. WriteEntityReferenceLink -> one param.
6. EntityContainers() is gone -> EntityContainer, FindContainer is gone.
7. ReadEntityReferenceLink takes no param.
8. ParseOrderBy/Filter/SelectExpand static method is gone.
9. Version is gone in metadata.
10. IsAlwaysBindable is gone for action an function,SetIsAlwaysBindable is gone
11. GetServiceVersion is gone.
12. SetServiceDocumentUri is gone.
13. String function parameter should be single quoted.
14. Content-ID header check.
15. Change Enum value binder.
16. ODataUriNullValue -> ODataNullValue.
17. If an action or function is requested in a selectItem using	a
qualifiedActionName or a qualifiedFunctionName and that operation cannot
be bound to the entities requested, the	service MUST ignore the	selectItem.
18. Only support Base64 format for binary.
19. Change to ODL V6.2 new UriParser for query option.
2014-04-08 10:43:42 +08:00
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