Commit Graph

39740 Commits

Author SHA1 Message Date
tugberkugurlu d7f711bca1 added replace claim functionality. fixes #232
- added ReplaceClaimAsync method to IUserClaimStore interface
 - implemented ReplaceClaimAsync method from IUserClaimStore inside the
   Microsoft.AspNet.Identity.EntityFramework.UserStore<TUser, TRole,
   TContext, TKey>
 - added ReplaceClaimAsync method to UserManager
 - added UserManager tests for ReplaceClaimAsync method.
 - added some UserStore tests for ReplaceClaimAsync implementation of
   IUserClaimStore
2014-11-04 12:02:17 -08:00
Ryan Nowak 08c591c74b Fix for #104 - RouterMiddleware should take ILoggerFactory in the
constructor

Did some cleanup here to make these tests work on CoreCLR. They weren't
using Moq for anything important.
2014-11-03 12:38:17 -08:00
Doug Bunting 90e41b905a Add `ModelMetadata.HtmlEncode` property
- use new `ModelMetadata.HtmlEncode` property in HTML helpers
 - specifically in default HTML display and editor object templates (e.g.
   `@Html.DisplayFor()`) when value is non-`null` and the template is invoked
   with template depth greater than 1
- similar to MVC 5.2 commit [2b12791aee4f](https://aspnetwebstack.codeplex.com/SourceControl/changeset/2b12791aee4ffc56c7928b623bb45ee425813021)

nits:
- remove dupe `null` check in `DefaultDisplayTemplates.ObjectTemplate()`
- move backing fields initialized with constants together in `ModelMetadata`
2014-11-03 12:23:33 -08:00
Pranav K d5515bfbb6 Adding arg null or empty checks to RazorViewEngine.FindView &
FindPartialView
2014-11-02 18:33:56 -08:00
Pranav K 74da350086 Remove enableInstrumentation from CompilerCache and IMvcRazorHost 2014-11-02 18:15:39 -08:00
N. Taylor Mullen 4720381d78 Change the IRazorCompilationService's DI lifetime.
- Modified the MvcServices registration of IRazorCompilationService to be transient to ensure the IMvcRazorHost does not maintain state.
2014-10-31 22:41:07 -07:00
Ryan Nowak 30884d8d26 Removing types marked as obsolete 2014-10-31 18:54:18 -07:00
Ryan Nowak b8645eeb31 Follow up to JsonResult changes
Changing the WebAPI shim to use the new and improved JsonResult.
2014-10-31 18:33:15 -07:00
Ryan Nowak 0ccfcc4316 Fix for breaking API change from routing 2014-10-31 18:23:19 -07:00
Ryan Nowak 87f0bbb092 adding tests 2014-10-31 16:00:04 -07:00
Ryan Nowak aae9e67773 add docs 2014-10-31 15:02:54 -07:00
Ryan Nowak 105c99cbf2 Fix #1370 - Always use the provided formatter in JsonResult
The change here is to always use the provided formatter, instead of using
it as a fallback. This is much less surprising for users.

There are some other subtle changes here and cleanup of the tests, as well
as documentation additions.

The primary change is that we still want to run 'select' on a formatter
even if it's the only one. This allows us to choose a content type based
on the accept header.

In the case of a user-provided formatter, we'll try to honor the best
possible combination of Accept and specified ContentTypes (specified
ContentTypes win if there's a conflict). If nothing works, we'll still run
the user-provided formatter and let it decide what to do.

In the case of the default (formatters from options) we do conneg, and if
there's a conflict, fall back to a global (from services)
JsonOutputFormatter - we let it decide what to do.

This should leave us with a defined and tested behavior for all cases.
2014-10-31 14:30:31 -07:00
Ryan Nowak d78e5478a7 Fix for #65,116 - Implement 'stack of routers'
This is the routing part of the fix. MVC will be updated as well
(attribute routing).

As the graph of routers is traversed, routers add themselves to the
current 'path', which unwinds on a failed path.

This mechanism is opt-in. Whoever adds something needs to remove it as
part of cleanup. If a router in the tree doesn't interact with the
.Routers property, then there are no consequences for those that do.

Additionally, fixing #116 as part of the same change. This means that we
create a nested 'RouteData' and then restore it on the way out. This is
simpler than just dealing with the .Routers property in isolation.
2014-10-31 14:07:35 -07:00
sornaks d178200795 Adding functional tests for Filters. 2014-10-31 08:36:31 -07:00
David Fowler e1a88b6503 Merge branch 'release' into dev 2014-10-31 03:04:33 -07:00
David Fowler 1768bfd25f Added package descriptions 2014-10-31 03:00:59 -07:00
David Fowler f0bec06fe0 Merge branch 'release' into dev 2014-10-31 02:57:48 -07:00
David Fowler 82511a8489 Added package descriptions 2014-10-31 02:57:32 -07:00
David Fowler 4394a3e2fa Merge branch 'release' into dev 2014-10-31 02:46:34 -07:00
David Fowler 01a4d8d5bb Added package descriptions 2014-10-31 02:46:22 -07:00
David Fowler 9861d4cfaf Merge branch 'release' into dev 2014-10-31 02:31:34 -07:00
David Fowler c6c7b48358 Added package descriptions 2014-10-31 02:31:23 -07:00
David Fowler 6aed946a63 Merge branch 'release' into dev 2014-10-31 02:12:01 -07:00
David Fowler a5bd9d29e5 Added package descriptions 2014-10-31 02:11:42 -07:00
David Fowler c98019883b Merge branch 'release' into dev 2014-10-31 01:48:30 -07:00
David Fowler 0174d213d1 Added package descriptions 2014-10-31 01:48:15 -07:00
David Fowler 5696f3fd5d Merge branch 'release' into dev 2014-10-31 01:39:06 -07:00
David Fowler 3bbdce3511 Added package descriptions 2014-10-31 01:38:05 -07:00
David Fowler 7277dc910a Merge branch 'release' into dev 2014-10-31 01:07:04 -07:00
David Fowler c9e0f9beb1 Added package descriptions 2014-10-31 01:06:50 -07:00
David Fowler b7b0a4468a Merge branch 'release' into dev 2014-10-31 00:53:10 -07:00
David Fowler 5ae262f394 Added package descriptions 2014-10-31 00:52:45 -07:00
Pranav K 3aaeebd9c5 Revert "Revert "Added a functional test for view precompilation""
This reverts commit 6b2ab32885.
2014-10-30 14:38:44 -07:00
Doug Bunting 5420b9d382 More `ViewDataDictionary` tests
- separate and extend `ViewDataDictionary<TModel>` tests
2014-10-29 19:19:09 -07:00
Doug Bunting c89bca5924 Adjust tests to handle new `ViewDataDictionary` invariants
- ensure `ViewDataDictionary` constructors are not passed a `null` or
  `Mock.Of<IModelMetadataProvider>()` instance
 - `ViewDataDictionary` constructors always use the `IModelMetadataProvider`
- `viewData.ModelMetadata` now never `null`
- `ViewDataDictionary<int>.Model` no longer throws if read before it's written
- `ViewDataDictionary.ModelMetadata` now copied to new instances in fewer cases
 - e.g. don't use unusual `object` datatype with customized `ModelMetadata`
2014-10-29 19:18:59 -07:00
Doug Bunting 97aaa7049e Correct code checking for `ViewDataDictionary.ModelMetadata==null`
- `null` checks can generally be removed but in one case needed to
  special-case metadata for `object`

nit: remove duplicate empty `string` check in
`ExpressionMetadataProvider.FromStringExpression()`
2014-10-29 19:18:31 -07:00
Doug Bunting e73655229c Correct some `ViewDataDictionary` constructor calls
- ensure correct `ViewData.ModelState` value in a `RazorPage` instance
- let view components inherit `ViewData.Model` from surrounding context
- do not create an isolated `ViewDataDictionary<TModel>` in one HTML helper
 - allows previous `ViewDataDictionary<TModel>` constructor to be `internal`
  - also add comments for that constructor
- change two `ViewDataDictionary` copy constructor calls to avoid uselessly
  copying `Model` and related information from source
2014-10-29 19:18:20 -07:00
Doug Bunting a3b07dacdb Rework `ViewDataDictionary` constructors to ensure `ModelMetadata` is never `null`
- `ViewDataDictionary<TModel>` constructors now pass `typeof(TModel)` to base
  `protected` constructors
 - move type compatibility checks into base `ViewDataDictionary`
 - remove `ViewDataDictionary<TModel>.ModelMetadata` override
- don't retrieve `ModelMetadata` twice in a single constructor invocation
- remove newly-unused `protected` properties and use `private` fields in copy
  constructors

Address longstanding problems found (see #1466)
- avoid reusing `ModelMetadata` after `Model` value changes
 - reset `ModelMetadata` backing field in `Model` setter
 - `Model` and `ModelMetadata.Model` could previously get out of sync
- carry `ModelMetadata` forward from an outer scope only if `Model` matches
 - previously two scopes could have different `Model` values but share their
   `ModelMetadata` (and `ModelMetadata.Model`)
 - related to previous item but didn't require `Model` setting; switching
   to a property of the same type as containing `Model` was enough
- avoid NRE if `ViewDataDictionary<int>.Model` is read before it's written
 - problem affected all non-`Nullable` value types
- `ViewDataDictionary.ModelMetadata` setter should throw if value is `null`

nits:
- add and reword doc and code comments
 - `ViewDataDictionary<TModel>` constructors should only inherit base's
   parameter descriptions; have more information in the derived class
- make a few `ViewDataDictionary` properties get-only
- clean up `using` statements in `ViewDataDictionary<TModel>`
- make two constructors `internal`
2014-10-29 19:03:58 -07:00
Ryan Nowak 83187945d1 Fix for #1052 - ViewComponents should support fully qualified names
This change adds the concept of a full-name to viewcomponents. View
components can be invoked using either the short name or long name. If the
provided string contains a '.' character, then it will be compared against
full names, otherwise it will be matched against short names only.

The short name is used for view lookups.

If the name is explicitly set via ViewComponent attribute, then the full
name is the name provided. The short name is the portion of the name after
the last '.'. If there are no dots, then the short name and full name are
the same.

If the name is not set explicitly, then it is inferred from the Type and
namespace name. The short name is the Type name, minus the 'ViewComponent'
suffix (if present). The full name is the namespace of the defining class,
plus the short name.
2014-10-29 17:34:01 -07:00
Kirthi Krishnamraju dc1aaf0664 Merge branch 'release' into dev 2014-10-29 13:42:56 -07:00
Kirthi Krishnamraju 028a2359a4 Added description in project.json for all projects 2014-10-29 13:40:31 -07:00
Kirthi Krishnamraju a858373409 Merge branch 'release' into dev 2014-10-29 13:26:50 -07:00
Kirthi Krishnamraju bc0b61b6f2 Merge branch 'release' into dev 2014-10-29 13:19:43 -07:00
Kirthi Krishnamraju 40b2da7cc7 Added description to project.json 2014-10-29 11:45:42 -07:00
Kirthi Krishnamraju 85d0ddc45a Added description in project.json for all projects 2014-10-29 11:38:09 -07:00
SonjaKhan ac14c3222b making page generator work for different libraries 2014-10-29 11:36:52 -07:00
N. Taylor Mullen 7ab25918e0 Add tests to validate @removetaghelper functionality.
- Added utility methods to construct valid SyntaxTreeNodes that represent the @removetaghelper directive.
- Added parse level unit tests to validate the @removetaghelper generates an accurate SyntaxTreeNode.
- Added parse level unit tests to validate the @removetaghelper throws with bad formats.
- Added TagHelperRegistration unit tests to validate the AddOrRemoveTagHelperCodeGenerators are understood and affect the descriptors found.
- Added Designtime mapping tests to validate correct source mappings are made to ensure proper coloring and lack-of C# intellisense.
- Added end-to-end tests to validate @removetaghelper can essentially disable TagHelpers on a page.

#112
2014-10-29 11:31:00 -07:00
Pranav K 2934bb866d Removing transitive dependencies from project.json 2014-10-29 11:23:57 -07:00
Pranav K fb51830598 Merge branch 'release' into dev 2014-10-29 11:04:28 -07:00
Pranav K edefdf6b2f Updating Newtonsoft.json version to 6.0.6 2014-10-29 10:32:37 -07:00