Commit Graph

43 Commits

Author SHA1 Message Date
Pranav K 43226fe54d Modify FileVersionProvider to cache missing file info.
Fixes #3765
2015-12-23 14:32:39 -08:00
Hao Kung 0e8113e393 OptionsModel => Options rename 2015-12-21 15:00:31 -08:00
ryanbrandenburg 3393ba43c2 * Parameters into the messages 2015-12-11 12:05:44 -08:00
Ryan Nowak 96de1dbe4b Remove IExcludeTypeFilter
- Removes IExcludeTypeFilter
- Replaced with a property 'ValidateChildren' on ModelMetadata
- Teach ValidationVisitor to respect 'ValidateChildren' for enumerable
  types.
2015-12-09 12:30:13 -08:00
Pranav K 7e2eb16960 React to Microsoft.AspNet.Html namespace rename 2015-12-02 11:15:54 -08:00
Pranav K 017bf1a20f Changes to use moq-netcore 2015-11-25 16:04:04 -08:00
N. Taylor Mullen a1af85beb7 Remove System beta tag in project.json for coreclr packages. 2015-11-12 12:24:39 -08:00
Ajay Bhargav Baaskaran 1927730f40 [Fixes #3426] Removed defensive copy in CompositeModelBinder and CompositeModelValidatorProvider 2015-11-06 12:21:08 -08:00
Ryan Nowak e2c2676042 Add InputFormatter buffer pooling 2015-11-02 14:36:59 -08:00
Chris R 52f4a83139 React to WebEncoders changes. 2015-10-30 17:59:19 -07:00
Pranav K f57e180971 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:53 -07:00
Ryan Nowak 4e08eda58d Use pooled memory for the streamwriter 2015-10-02 14:35:15 -07:00
Doug Bunting 28aec3f5cc Support user overrides of system-provided `ModelError` messages
- #2969
- add `ModelBindingMessages` for configuration and `IBindingMetadataProvider` overrides
  - use `interface` to avoid `new` oddities when adding a setter to an `abstract` property
- add `IModelBindingMessages` to `ModelMetadata` for use in rest of the product code
- plumb the various bits through the system
- add integration tests using a custom `IBindingMetadataProvider`s to override messages

nits:
- remove unused resources
- use `AttemptedValue` and not `model` in `SimpleTypeModelBinder`
2015-09-28 15:50:21 -07:00
Kirthi Krishnamraju 0889b18f95 Add localizers to validation attributes 2015-09-25 16:13:21 -07:00
Pranav K 9eb2c5b810 Reacting to IExpirationTrigger -> IChangeToken rename 2015-09-22 08:14:34 -07:00
Ryan Nowak a318c4599a API Review - Split up .Actions
Abstractions - Core MVC extensibility

Controllers - MVC implementations of .Abstractions and supporting
contracts

Infrastructure - General purpose support APIs. Metadata APIs that don't
fit clearly with a feature or with .Abstraction
2015-09-21 21:54:02 -07:00
Pranav K 66a04c2fd6 Replacing NotNullAttribute with thrown exceptions 2015-09-21 10:26:14 -07:00
Doug Bunting 0476d53f1d [quick fix] Allow `TestCommon` project to build successfully
- otherwise may fail in VS or when using `BuildV2` from the command line
2015-09-18 16:45:01 -07:00
Ryan Nowak 046cb976b3 Move ActionResult classes back to main namespace 2015-09-16 21:42:31 -07:00
Ryan Nowak 465b4ce0df Use TelemetrySource 2015-09-06 20:23:05 -07:00
David Fowler 2834b70987 Added frameworks to project.json 2015-09-05 11:03:00 -07:00
Ryan Nowak 229724c4ea Reorganize MVC namespaces 2015-09-01 22:28:33 -07:00
Ryan Nowak e384938425 Add more event notification data points
Also includes some cleanup of the testing code that we're using with
proxies.
2015-08-16 16:42:58 -07:00
sornaks 27f7f3d437 Issue #2779 - Normalize newlines to "\r\n" instead of "\n". 2015-08-14 17:13:29 -07:00
sornaks b6a109e2a3 Making DefaultDisplayTemplates and DefaultEditorTemplates use IHtmlContent.
- Making TagBuilder's InnerHtml an IHtmlContent.
- Delay encoding until the content is written.
- Moving BufferedHtmlContent to Common cos it is used in aspnet/Razor also.
- Changing GenerateOption to take in a string and create StringHtmlContent.
- This reduces the space used by around 13%.
2015-08-10 14:55:34 -07:00
Ryan Nowak 6170ac1924 Add an event notification for when the action is invoked 2015-07-16 11:10:45 -07:00
Ryan Nowak e985fa5d42 Split up MVC.Extensions into smaller packages
Startup.cs API experience to follow in a separate change. This change just
gets the bulk of the code churn out of the way.
2015-07-06 23:41:22 -07:00
sornaks 68523a3550 Fixing tests in Mono.
- Disabling tests which have corresponding bugs in mono.
- Fixing a few tests which do not handle *nix file system.
- Updating Travis configuration to use mono's alpha bits.
- Introducing PlatformNormalizer to normalize content across multiple platforms.
2015-07-02 17:24:14 -07:00
Doug Bunting 9c63d1d842 Get tests working with `core.autocrlf=false`
- #1514
- refactor `RazorCompilationService` to allow a test subclass that normalizes Razor file line endings
 - add `TestRazorCompilationService` to `RazorPageExecutionInstrumentationWebSite`
 - adjust line endings to match in `RazorPageExecutionInstrumentationTest`
- add `ignoreLineEndingDifferences: true` to `Assert.Equal()` calls
 - responses on Windows can have a mix of line endings
  - `git config` setting affects line endings in .cshtml (and baseline) files
  - however MVC and Razor mix `Environment.NewLine`s into HTTP responses
- update `PrecompilationTest` to split response regardless of line endings
- update `ResourceFile` to normalize all source file streams to LF only
 - ensures consistent checksums and line mappings
 - change `MvcRazorHostTest` to expect new line mappings
 - recreate baseline files to expect new checksums and literal line endings
- use verbatim strings in affected tests
 - careful use of `Environment.NewLine` in expectations is now just noise

nits:
- add doc comments in `RazorCompilationService`
- correct `TagHelpersTest` name to match containing file
- avoid incorrect `using` removal when `GENERATE_BASELINES` is not defined
- remove unnecessary `ResourceFile` normalization of output files
2015-06-24 14:53:07 -07:00
Ryan Nowak a679e87a9b Split Mvc.Core
This is the first step is some more refactorings to come in the future
with the goal of making MVC less monolythic. This makes the core of MVC
more reusable and more in line with the design of other vNext platform
components.

With this change, Mvc.Core contains just the minimal guts needed to build
a working app.
- Action Discovery
- Action Invoker
- Filters
- ObjectResult
- Model Metadata
- Model Binding
- Formatters
- Validation System

And yes, we are aware of the irony of 'minimal MVC' not including the view
system. The idea is that this is the kernel of an MVC app, and anything
real is layered on top.

The most noticable impact of this change is that MvcOptions has been blown
apart into more managable chunks. See the various ConfigureMvc*** methods.

The new Mvc.Extensions package is a placeholder while we evaluate and tune
the new definitions. Expect more changes as features are move to their own
packages, and in some case their own repositories.

For now there is no experience to bootstrap an Mvc.Core app. That's coming
next.
2015-06-09 02:12:13 -07:00
Ryan Nowak 03571cc27b Event Notification for MVC Prototype
Here's a first take on the pattern for publishing notifications from MVC.
2015-06-08 17:49:33 -07:00
Doug Bunting ffd1dc1fb0 Add support for generating baseline output files while testing
- baselines include both expected output and design-time line mappings
- controlled by GENERATE_BASELINES
 - assertions related to file content are not checked in this mode
- add design-time test of Basic.cshtml to `MvcRazorHostTest`
- regenerate all files to avoid BOM and blank line noise in future PRs
 - update out-of-date design-time Basic.cs file

nits:
- make a few variable names more consistent
- make `Assembly` fields `static`
- remove unused `_resourcesAssembly` field from `ErrorPageTests`
- remove `ResourceHelpers` which was specific to functional tests
2015-06-01 13:13:39 -07:00
Kiran Challa c0ca6214c2 React to Caching api changes 2015-05-05 10:08:50 -07:00
N. Taylor Mullen 64e726d2b2 Update LICENSE.txt and license header on files. 2015-05-01 13:55:25 -07:00
Chris Ross 017e44ae95 Handle FileProviders package changes. 2015-04-23 12:56:10 -07:00
Pranav K fb451b51e5 Added SourceLocation to inherited chunks \ tag helpers
Updated CompilationResult to support compilation failures from multiple
files.

Fixes #2321
2015-04-17 11:23:38 -07:00
Harsh Gupta c67236141b Fixes 2304:
The fix splits client validation and model validation into two separate hierarchies.
Introduced ClientModelValidatorProvider in MvcOptions, which can be iterated to produce IClientModelValidators.
As a result of this, HtmlGenerator code can be free of ActionBindingContext and directly consumes options.
This also means that we do not modify the client validations during resource filters.
2015-04-15 14:30:46 -07:00
Doug Bunting 393aa54545 Update .xproj files for Microsoft.Web.AspNet.* -> Microsoft.DNX.* rename 2015-04-02 13:49:27 -07:00
Doug Bunting 5882cdb03f MVC portion of aspnet/Razor#335
- set correct `MarkAsHtmlEncodedMethodName` value in `MvcRazorHost`
- handle `HtmlString` values in `TagHelperOutput.Attributes` in `RazorPage`
 - special-case double-quotes in `HtmlString` values
 - add `static WriteTo()` method for use in tag helpers
- handle non-`string` `output.Attributes` values in tag helpers
- make `TagHelperContentWrapperTextWriter` a `public` class
- provide a `TagHelperContent.Append(object, ...)` extension method
- add `LinkTagHelper.Href` and `ScriptTagHelper.Src` properties
 - avoid Razor HTML-encoding these attribute values before their use
- add `JavaScriptEncoder` properties in `LinkTagHelper` and `ScriptTagHelper`
 - allow encoding testing without unit testing the default encoder
- handle MVC and Razor changes for this bug in existing tests
- add functional tests of encodings
- add test encoders to TestCommon project

nits:
- correct `InputTagHelper` to pass `type=""` through unchanged
- set correct `TagHelperContentTypeName` value in `MvcRazorHost`
- remove unnecessary `FormTagHelper.Method` and `OptionTagHelper.Selected` properties
- remove complex ternaries and `ShouldAddFileVersion()` methods
- add a few debug assertions
- fix some odd wrapping
- remove or `#if`-out unused `using`s
- remove trailing whitespace
2015-03-30 10:54:00 -07:00
Ryan Nowak 784021cf85 Fix ModelMetadata.IsRequired
The DataAnnotationsMetadataProvider was setting the bool? IsRequired, all of the
time instead of only setting it to true when we found a RequiredAttribute.
So we never actually executed the fallback logic here. Found
this while working on removing some reflection code from the validator,
and wanted to split it out because it's simple.
2015-03-23 15:32:43 -07:00
Ryan Nowak f5e7a69693 Updates to the extensibility for validator providers
This change removes reflection from validator providers, and instead
relies on cached metadata in in the modelmetadata.

In general this means that our MVPs don't need to cache anything, they
just look at the metadata and create what they need.

In the case of data-annotations, we update the model details provider to
add validation attributes to the modelmetadata. This would allow someone
to replace the DataAnnotationsValidatorProvider, but still use the
metadata in these attributes.

The change to the IModelValidatorProvider api (to use a context) is
intended to minimize allocations. Currently each validator provider needs
to return a list so you end up with N+1 lists (N validators + a final list
to compine them all). This change will let us just create the final list
(and a small context object). This is a very very high traffic API so it
seemed worth doing.

There's also some general massaging of namespaces and file locations.
2015-03-20 15:19:25 -07:00
Praburaj 88aa820b9f Reacting to File System changes
IFileProvider is becoming readonly.
2015-03-20 11:41:41 -07:00
Ryan Nowak fc00aff7c5 Add TestCommon project 2015-03-16 13:49:29 -07:00