Commit Graph

217 Commits

Author SHA1 Message Date
Yishai Galatzer a5afd3eb42 ActionResult implements IActionResult, and all our default implementations now use ActionResult
All controller methods return the specific ActionResult type
2014-04-25 15:57:02 -07:00
Pranav K f5ba63ea1e Fixing missing files in kproj
Fixing typo in sample filter
2014-04-25 14:48:14 -07:00
Sebastien Ros 0fe028a4dd Implementing Authorize attribute
#272
2014-04-24 16:21:43 -07:00
dougbu b8731621df Add default `Display*()` templates
- first get old code in correct spot
- then get default templates working in new world
 - usual things: `[NotNull]`, `var`, internal -> public
 - provide a `HtmlHelper.GenerateOption()` static method
 - pass an `ViewDataDictionary<object>` instance to `TemplateRenderer` constructor
 - run default templates synchronously with an IHtmlHelper<object>
 - copy over resources
 - add Microsoft.Data.Entity reference for EntityState type
- use default templates in MVC sample
 - remove most on-disk overrides of the default templates
2014-04-19 19:00:42 -07:00
David Fowler 05a2319d84 Moved BuilderExtensions to Microsoft.AspNet namespace 2014-04-18 00:51:27 -07:00
David Fowler 73b7509368 Updated to use new UseServices API 2014-04-17 21:13:43 -07:00
David Fowler fba1b400fe Removed comment 2014-04-17 20:00:06 -07:00
David Fowler 73e1386724 Added UseMvc extension method via IBuilder extensions. 2014-04-17 19:55:23 -07:00
Louis DeJardin f19fe0cbef Filters version 2.0
This is functionally much more similar to legacy MVC.

Rather than a pure single pipeline, filter execution takes place in more
stages.
2014-04-17 11:45:58 -07:00
David Fowler 93c9b3419e Made some changes to the MvcApplication class
- Renamed it to MvcRouteHandler
- Removed required IServiceProvider ctor param.
- The HttpContext flows the application services through to MVC. This does
 require a call to app.UseContainer in order for things to work but that should be fine.
 This will be the pattern we use for all frameworks going forward and we'll need to have some
 good error handling around this area when things aren't wired up properly.
2014-04-17 00:02:10 -07:00
David Fowler 4fc0b56dfa Added extension method to ServiceCollection to register default services 2014-04-16 23:59:36 -07:00
Ryan Nowak 40e7fcc9ba Turning on warnings as errors 2014-04-16 20:21:07 -07:00
harshgMSFT 72732868c6 Adding DisplayName, Label HtmlHelpers. 2014-04-16 11:41:47 -07:00
dougbu 246bb2e3dd Add `DropDownList()` and `DropDownListFor()` HTML helpers
- copy over legacy MVC's `SelectExtensions`, `SelectListItem` and `SelectListGroup`
 - plus expected `SelectList` and `MultiSelectList`
- fixup select HTML helpers to meet WebFx standards and work in new world
 - usual stuff: `[NotNull]`, `var`, `String` -> `string`, long lines, ...
 - remove `IDictionary<string, object> htmlAttributes` overloads
 - move longest extension method overloads into correct classes / interfaces
 - add `ViewDataEvaluator.Eval()` overload for an `object` container
 - rename lower-level helpers to make purposes more obvious
 - nit: move Raw() methods up from bottom of HtmlHelper.cs
- use `DropDownList[For]()` in MVC sample
2014-04-14 16:05:07 -07:00
dougbu 271c849923 Fix #231; add `ViewBag` to `ViewComponent`
- update MVC sample to demonstrate use and that `ViewBag` is scoped
- nit: add a bit of padding between border and tag cloud words
2014-04-12 14:10:16 -07:00
dougbu ba08f8e8d8 Cleanup Display, Partial, and Validation extensions
- correct file and class names for some HH extensions
 - three class names were correct but didn't match containing file
 - three class and file names matched but didn't start with HtmlHelper
- clean up trailing whitespace and long lines in changed Extensions.cs files
 - `HtmlHelperPartialAsyncExtensions`, `HtmlHelperRenderPartialAsyncExtensions`
   and `HtmlHelperValidationExtensions` lacked some `[NotNull]` attributes
- merge extension files by concept
 - Display / DisplayFor / DisplayForModel methods all into `HtmlHelperDisplayExtensions`
 - Partial / RenderPartial methods all into `HtmlHelperPartialExtensions`
- use `IHtmlHelper<TModel>` everywhere
2014-04-10 17:12:16 -07:00
Ryan Nowak 408d4056b1 Rearrange ViewContext 2014-04-10 11:40:57 -07:00
dougbu f0a97772f5 Add remaining HTML input helpers
- add `CheckBox[For]()`, `Hidden[For]()`, `Password[For]()`, and
  `RadioButton[For]()`
- also make `FormatValue()` visible to users, as it is in legacy MVC
- and spread the boxes out a bit in MyView 😺
2014-04-09 12:52:47 -07:00
David Fowler a970fa04ab Updated to use the new tooling 2014-04-09 12:24:16 -07:00
Ryan Nowak 4e1511ed4d Adding ActionLink 2014-04-09 11:07:15 -07:00
Ryan Nowak ab605ef935 Fix for #215 - nullref trying to generate link in a partial
The fix here is to do some cleanup we've been planning to do for a while,
rather than flowing IUrlHelper and IComponentHelper as part of the
ViewContext, they now are just grabbed from the service provider.

This simplifies the code for invoking a view, and gets us closer to the
desired API surface of ViewContext
2014-04-08 16:05:48 -07:00
Ryan Nowak faa8251b70 Merging Mvc.Rendering and Mvc.Core 2014-04-07 17:32:49 -07:00
Ryan Nowak ec4b3a29c0 Adding smart link generation
This feature will enforce a contract that link generation has to point to
a real action. Read the comments in code for more details and rationale.
2014-04-07 14:37:52 -07:00
Ryan Nowak d2386d7ded CR Feedback 2014-04-07 12:49:30 -07:00
Ryan Nowak 37f4e2efaa Adding more overloads for IUrlHelper
(cherry picked from commit 4ebe6b5e386388914160b07c91142a9e7483134b)
2014-04-07 12:49:29 -07:00
dougbu 1cd15fbf60 Add form HTML helpers and `MVCForm`
- copy over from legacy MVC
- fixup namespaces, remove copyright notices, ...
- temporarily remove `RouteBeginForm() overloads
- move main components to `HtmlHelper` and declare in `IHtmlHelper<T>`
- change `UrlHelper` to avoid treating an existing dictionary as an object
- add `HtmlHelper.Createform()` factory
- use in MVC sample; move BeginForm / TextBox samples to a new row
2014-04-07 12:04:28 -07:00
N. Taylor Mullen 671c7dd59e Addressed code review comments. 2014-04-06 16:01:41 -07:00
N. Taylor Mullen 5026788145 Add sample for DisplayForModel Html Helper.
Showcased a lot of the core pieces of DisplayFor in the sample.  Some pieces are still missing such as DataType handling.  The infrastructure is there to handle it in the TemplateRenderer but the model metadata providers do not construct the metadata with the data types.
2014-04-06 16:01:33 -07:00
N. Taylor Mullen 94bae850c7 Add sample for DisplayFor Html Helper.
Showcased a lot of the core pieces of DisplayFor in the sample.  Some pieces are still missing such as DataType handling.  The infrastructure is there to handle it in the TemplateRenderer but the model metadata providers do not construct the metadata with the data types.
2014-04-06 15:59:42 -07:00
N. Taylor Mullen 2b3687282e Addressed code review comments. 2014-04-06 15:57:32 -07:00
N. Taylor Mullen 5dbd006165 Add sample for Display Html Helper.
Showcased a lot of the core pieces of Display in the sample.  Some pieces are still missing such as DataType handling.  The infrastructure is there to handle it in the TemplateRenderer but the model metadata providers do not construct the metadata with the data types.
2014-04-06 15:56:08 -07:00
Pranav K df9d5c4875 Adding support for Render Section
Initial draft for DefineSection \ RenderSection. This change is based on
changes to the Razor parser to enable Razor to generate HelperResults for
section instead of void delegates.
2014-04-03 14:26:54 -07:00
Pranav K 2e0bed750e Adding support for Url.Content, Href and ~/ in Razor views 2014-04-03 14:12:55 -07:00
Ryan Nowak 49de9d2828 Adding Value Html Helpers 2014-04-03 12:22:03 -07:00
dougbu 0a62a581de Add `TextBox` and `TextBoxFor`
- HtmlHelper service now needs an `IModelMetadataProvider` instance
- make `GetInputTypeString()` private
- use `TextBox()` and `TextBoxFor()` in MVC sample
- throw if `ExpressionMetadataProvider.FromLambdaExpression()` returns `null`
2014-04-02 20:49:48 -07:00
N. Taylor Mullen dad87c5239 Add ValidationSummary helper.
This enables Html.ValidationSummary.  This is in reference to WEBFX-97.
2014-04-02 14:58:08 -07:00
dougbu fbbc59b392 Add `Name()`, `NameFor()`, and `NameForModel()` helper methods
- `Name()` is a `virtual` instance method to allow useful derivation
- `NameFor()` is an instance method to avoid adding `GetExpressionName()`
  to the public surface; either method could be `virtual`
- `NameForModel()` is an extension method because it's not usefully overridden
- use `Name*()` in sample
2014-03-31 16:07:56 -07:00
N. Taylor Mullen 2de5d57348 Add PartialAsync and RenderPartialAsync.
This enables Html.PartialAsync and Html.RenderPartialAsync.  It also includes a sample to showcase the features.  This is in reference to WEBFX-95.
2014-03-31 12:19:10 -07:00
Pranav K f1efbde29d Revive HelperResult to allow using @helper in views 2014-03-28 11:08:15 -07:00
dougbu 655b329dd0 Increment System.Threading.Tasks package version
- today's build break, mark II

also remove dangling reference to TestCommon
2014-03-27 19:56:27 -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
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
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 e393c25f87 Added self host support to the json file 2014-03-24 21:45:17 -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
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
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
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
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
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
Ryan Nowak a5cb050b97 Using AutoFac to register open generic service types 2014-03-14 12:46:17 -07:00
David Fowler 930986d6a2 Migrate samples from hacky self host to helios
- MvcSample should be deleted and all new code should be written in MvcSample.Web
2014-03-14 10:25:13 -07:00
David Fowler b482a9e3cb Made roslyn based compilation of razor files work
- Now that services are being flowed through the entire stack
we can nuke the csc service and always use the roslyn based compilation for views
- The RoslynCompilationService is still very much a prototype but it's a good
 step to see what other services might may or may not need to flow.
- Removed the PhysicalFileSystem construction from Mvc itself. This will come from
 the hosting layer and is newed up temporarily in the PathBasedViewFactory itself.
2014-03-08 15:16:44 -08:00
Ryan Nowak 9d0cea17dd Changes due to changes in routing take 2 2014-03-06 12:26:09 -08:00
Ryan Nowak 905e84ab0a Changes in WebFx for compatibility with routing 2014-03-05 20:51:41 -08:00
Pranav K 914d8e8a3b Updating DI to use ServiceDescriptors
Fixes #25
2014-03-05 15:59:33 -08:00
Ryan Nowak 1cb8a049f2 This is a TEMPORARY fix to unblock WebFX samples.
More changes are coming to the routing API surface, so this will be
cleaned up with a final version soon.
2014-03-05 14:40:37 -08:00
David Fowler 9dc79df9cf Fixed core clr compilation error. 2014-03-05 01:04:23 -08:00
Yishai Galatzer 6244d55e1f Rename MVC -> MVC.Core, MVC.Startup -> MVC 2014-03-02 23:16:18 -08:00
David Fowler 5ea11e396d Added first core clr enabled sample. 2014-02-15 01:20:32 -08:00
David Fowler 125ca080b5 Added a sample web project 2014-02-14 03:03:02 -08:00