Commit Graph

266 Commits

Author SHA1 Message Date
Pranav K cb21c34770 Reintroduce ModelStateDictionaryTest 2014-03-26 17:32:45 -07:00
Pranav K 8e495158ef Modifying ModelStateDictionary to derive from IDictionary
* Reintroducing methods that weren't ported over earlier
2014-03-26 17:29:45 -07:00
Ryan Nowak 6da448fb8e Commonizing JSON writer/serializer code
This doesn't add any new extensibility, and will likely change again in
the future when we add extensibility. For now this is a stopgap to reduce
duplication between JsonResult and JsonViewComponentResult.
2014-03-26 17:02:44 -07:00
Ryan Nowak 469414c419 Adding support for scoped services in WebFX
We'll create a scoped service provider if the middleware that does it
isn't there.

We resolve all of our stuff from the scoped service provider, allowing
users to plug in any scoped things they want.

Ported UrlHelper to be a scoped service.
2014-03-26 12:45:36 -07:00
Ryan Nowak 21e48be06e Patternizing our property injection/initializer 2014-03-26 11:58:20 -07:00
dougbu 8ed5b7b079 Fix WebFx-169 and #118
- move `DynamicObject` derivation up to new `DynamicViewData` class, fixing [WebFx-169](http://projectk-tc:8080/browse/WEBFX-169)
- avoid direct `_data` lookup in previous `TryGetMember()`, fixing [#118](https://github.com/aspnet/WebFx/issues/118)
- rename ViewData -> ViewDataDictionary

Also
- flesh out `IDictionary<string, object>` implementation in `ViewData`
- provide `ViewData` copy constructor that allows TModel to change
- remove `TryGetIndex()` and `TrySetIndex()` implementations; use `ViewData[]` instead
- restore `ViewContext.ViewBag` from legacy MVC
2014-03-26 11:42:52 -07:00
Pranav K af7d61113b Updating test projects to use Microsoft.AspNet.Testing 2014-03-25 15:10:58 -07:00
Pranav K 12632c5fc3 Replacing not null checks in ModelBinding with NotNullAttribute : part deux 2014-03-25 15:10:57 -07:00
Ryan Nowak 6fb0d5b282 Commonize 'throw on view not found'
Deduping this code by moving it to ViewEngineResult.
2014-03-25 14:25:49 -07:00
Ryan Nowak fa21d1cd65 Remove extra TextWriter parameter from IView
This was here in the legacy code for legacy reasons. We're passing the writer
as part of the ViewContext, so we can remove this extra parameter.
2014-03-25 14:19:43 -07:00
Pranav K a2cea18529 Replacing argument not null checks in ModelBinding with NotNullAttribute
* Removing not null guard tests in ModelBinding
2014-03-25 12:35:33 -07:00
Ryan Nowak 86ac978451 Implementation of ViewComponents 2014-03-25 11:04:37 -07:00
David Fowler ed36084c25 Remove ifdef for net45 in sample 2014-03-25 02:12:33 -07:00
David Fowler 699b146d1f Bumped the version of immutable collections. 2014-03-25 02:06:59 -07:00
David Fowler e393c25f87 Added self host support to the json file 2014-03-24 21:45:17 -07:00
dougbu d3217fd3af Cleanup warnings
- primary action is removing interfaces from Razor that Core exports
- also remove an unused field from Core's `DefaultControllerAssemblyProvider`
2014-03-22 18:58:23 -07:00
David Fowler 47b33b907f Removed System.Runtime.Hosting dependency 2014-03-22 15:17:11 -07:00
Ryan Nowak 89b53aab25 Fix API change in ITypeActivator 2014-03-21 18:16:02 -07:00
Ryan Nowak dc6843acf7 Move registration of nested provider infrastructure
The DI system has support for registering open generics now, so we can go
through that instead of directly through autofac.
2014-03-21 16:47:31 -07:00
N. Taylor Mullen 5b6eb307ae Re-plumb ModelState.
Modified ModelState to only ever be created on the ActionContext and then plumbed/exposed it on ViewData and Controller.  This will enable: ActionFilterContext's will have access to ModelState via its ActionContext member, allow HTMLHelpers to access ModelState via ViewData, and unify the locations of "source" model state.  In the old world we used to copy/replace/instantiate new model state all over unnecessarily.
2014-03-21 16:19:13 -07:00
dougbu 32d031c6eb Add `ModelMetadata` to `ViewData`
- demonstrate `ModelMetadata` is available in a view

Also
- simplify `View()` overloads in `Controller`, pending #110 decisions
- make `Model` in `RazorView<T>` readonly
2014-03-21 14:42:42 -07:00
Pranav K 857a239990 Making Moq version in Mvc.Core.Test consistent with all other test projects 2014-03-21 14:11:49 -07:00
harshgMSFT f20b798a07 Modifying the Default Action convention to have verb only methods 2014-03-21 12:34:42 -07:00
Pranav K f1c4a8e497 Change FormValueProviderFactory to use GetContentType for media type matching
Fixes #68
2014-03-21 12:10:12 -07:00
Ryan Nowak 1ca2203421 cr feedback 2014-03-21 11:13:15 -07:00
Ryan Nowak 6610788b75 Restore the TextWriter to ViewContext 2014-03-21 11:13:14 -07:00
Pranav K 8ea196023e Modify controller discovery to only look for types that reference Mvc.Core
assembly
2014-03-21 10:02:54 -07:00
Pranav K 683c5bf9b3 Adding JsonInputFormatter for reading json encoded data from the request
body
2014-03-20 20:48:25 -07:00
dougbu 4364986137 System.Text.Encoding has rev'd 2014-03-20 14:38:54 -07:00
Ryan Nowak c4a15f021f Passing additional data on the ViewContext for resolving views.
This will be necessary for partials, and for Components.

Basically, the view engine uses a dictionary of data to find the top level
view (for an action) - after we do that, we want this context to be
sticky, which means we need to pass it around. This ensures that partials
and components will be resolved under the same paths as the main view.

Currently this 'data' is just the route values - and there is an ongoing
discussing about the right design here. The data that's being passed WILL
change in the future.
2014-03-20 12:18:02 -07:00
Yishai Galatzer 8b6d39507d Feedback: Make common base class for all contexts and all of them expose FilterItem collection
ExtensionMethod will now apply to the base FilterContext class
2014-03-20 09:59:24 -07:00
Yishai Galatzer adffc95b81 AllowAnonymous attribute + Consumption + Sample 2014-03-20 09:59:24 -07:00
dougbu 5875452755 Quick fix-ups
- Move .NET test projects back into net45 folder
- Catch up with latest System.Runtime.InteropServices version
2014-03-19 23:41:17 -07:00
Yishai Galatzer dcc286a299 Refactor FindView to always take a viewName (no null support)
and only use RouteValues (or generically just Dictionary<string, object>).

This is temporary and will change once we get Partials (which are currently just dead code)

For now this will unblock ViewComponents
2014-03-19 18:48:36 -07:00
Pranav K f8dd52dfe3 Reintroducing BindingBehaviorAttribute attribute
* Porting MutableObjectModelBinder tests
* Fix issues in MutableObjectModelBinder introduced by changing from
  TypeDescriptors to reflection
2014-03-19 16:52:02 -07:00
harshgMSFT 9cd99a42a7 ActionExecutor implementation WebFx W113
The changes include:
1. Action executor changes required for supporting sync and async operations Taksk and Task
2. Adding test project for MVC core - This contains ActionExecutor Tests.
3. Also adding a resources file for MVC core project
2014-03-19 11:10:42 -07:00
dougbu 4bc7c36522 Merge two `TypeExtensions` classes into Common\TypeExtensions.cs
- add missing `[NotNull]` attributes
- remove now-unneeded usings for ...ModelBinding.Internal namespace

Also get ModelBinding test project working under CoreCLR
- create separate k10 and net45 folders under test in VS
- add `[InternalsVisibleTo]` to make `TypeExtensions` visible to test assembly
- correct tests' `CultureInfo` use to compile under CoreCLR
- ifdef out CoreCLR tests depending on Moq, ReadOnly, ...
- remove a couple of tests expecting TypeConverter to work
2014-03-19 09:53:40 -07:00
Yishai Galatzer 227121b3f9 CR Feedback 2014-03-19 09:26:20 -07:00
Yishai Galatzer 7d9a6297f9 Fix debug string 2014-03-19 09:26:19 -07:00
Yishai Galatzer cfb06c0de3 Areas feature - Phase I
1. Areas defined by the Area attribute
2. Areas are a routeconstraint on the actiondescriptor
3. Areas find pages through route values

Other changes:
1. Remove Path from ActionDescriptor - It doesn't make sense with this change
2. Add sample Area
2014-03-19 09:26:18 -07:00
Pranav K 072e2cc1f1 Updating DataAnnotations version in project.json 2014-03-18 20:56:08 -07:00
Pranav K eae9d3a951 Update GenericModelBinder.BindModel to use correct overload of
Activator.CreateInstance
2014-03-18 16:34:18 -07:00
dougbu 3a0add8be8 Cleanup pass: Move Rendering classes to correct namespace
- use Microsoft.AspNet.Mvc.Rendering namespace throughout assembly

Also
- move `IdAttributeDotReplacement` from `TagBuilder` to `HtmlHelper`
- remove commented-out code in `HtmlHelper`
- use `var` and `[NotNull]` more
- `String` -> `string`
- correct Resources references; add missing resources
2014-03-18 14:02:39 -07:00
dougbu 478c220ddb Revert "Merge two `TypeExtensions` classes into Common\TypeExtensions.cs"
This reverts commit d534471515.
2014-03-17 22:53:36 -07:00
dougbu f714425619 Revert "Address CR comments"
This reverts commit d815329f71.
2014-03-17 22:52:39 -07:00
dougbu d815329f71 Address CR comments
- reduce #if use
- remove outdated comment
2014-03-17 22:49:30 -07:00
dougbu d534471515 Merge two `TypeExtensions` classes into Common\TypeExtensions.cs
- add missing `[NotNull]` attributes
- remove now-unneeded usings for ...ModelBinding.Internal namespace
- remove TypeExtensionTests.cs; don't add .NET 4.5-only
  `[InternalsVisibleTo]` for low-level `IsCompatibleWith()` extension
2014-03-17 21:02:25 -07:00
David Fowler a8cc6828dd Nuke the old MvcSample self host sample 2014-03-17 19:00:12 -07:00
dougbu ed1b2ddcc3 Run unit tests during builds
- add "test" command
- use latest (forked) XUnit packages
  update package references
  [PropertyData] -> [MemberData]
  Xunit.Extensions -> Xunit or Xunit.SDK
  Moq now available for .NET 4.5 only
- delete a couple of unit tests checking for ArgumentNullException
- provide TestCommon classes in Razor and Razor.Host test projects
- make ReplaceCulture internal because it's a shared source
2014-03-17 16:28:25 -07:00
N. Taylor Mullen f8179f03e4 Trigger view rendering asynchronously.
This is as simple as modifying the base class to return task and await the ExecuteAsync method.  Also added a piece to the sample project to verify functionality.
2014-03-17 12:18:54 -07:00