Commit Graph

364 Commits

Author SHA1 Message Date
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
David Fowler a8cc6828dd Nuke the old MvcSample self host sample 2014-03-17 19:00:12 -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 1a430f90ed porting to web sample 2014-03-14 13:06:27 -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
Pranav K e434918337 Reintroduce model validation 2014-03-12 21:55:50 -07:00
Stephen Halter cca3f92c5f Temporarily migrate the MvcSample project to Autofac 2014-03-12 15:17:41 -07:00
Ryan Nowak 00f15669dc More CR feedback on URL generation 2014-03-12 11:12:52 -07:00
Ryan Nowak 12985c19ee CR feedback 2014-03-12 10:57:47 -07:00
Ryan Nowak 0ce2c511d4 Adding URL generation to WebFX for controllers and views
This follows a similar pattern to html helpers - a minimal basis interface
that performs the main functionality, and a set of extension methods that
make up the rich API.
2014-03-12 10:57:46 -07:00
Yishai Galatzer 6f0151ba5e CR Feedback, add ordering sample to the MVCSample.
null result handling in ActionResultFilterEndPoint
2014-03-10 22:13:06 -07:00
Ryan Nowak 86f18f5da7 Moving ViewContext to rendering, breaking coupling to RequestContext 2014-03-10 16:15:46 -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
David Fowler 360f81d0a8 Added required packages for K 2014-03-08 01:10:02 -08:00
Yishai Galatzer 5503aa7b4a Remove comment 2014-03-06 17:02:49 -08:00
Yishai Galatzer 7cf40c8a50 CR feedback 2014-03-06 17:02:47 -08:00
Yishai Galatzer a55a71a4f8 ResultFilter attribute added to sample 2014-03-06 17:02:46 -08:00
Yishai Galatzer 772f833dc9 Action filters & Authorization Filters working 2014-03-06 17:02:45 -08:00
Yishai Galatzer 6fed92695b Filter execution 2014-03-06 17:01:40 -08:00
Yishai Galatzer 457016a6da Add the actual filters interface signatures,
Add the AuthorizationFilterAttribute
2014-03-06 17:00:43 -08:00
Yishai Galatzer 75bccbae21 Filter discovery 2014-03-06 17:00:42 -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
Pranav K e87f8c372c Consume ModelBinding from Mvc
* Modify ReflectedActionInvoker to model bind parameters
* Introduce IBodyReader for reading request bodies
* Introduce types for per-action-context specific binders, value providers
  and body readers
2014-03-05 10:13:52 -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 346f02e37c First stab Roslyn based compilation service for razor pages
- Flow the host service provider to MvcServices
- Use assembly neutral interfaces to access host services
- Added RoslynCompilationService to Microsoft.AspNet.Mvc.Razor
- Modified self host sample as helios needs to be updated to flow more services
2014-03-02 01:14:01 -08:00
Pranav K 9915b1c767 Reintroduce WriteAttribute methods on RazorView type 2014-02-24 19:55:48 -08:00
Ryan Nowak 9d056167e8 Overload Resolution Skeleton 2014-02-20 11:37:33 -08:00
Yishai Galatzer 941a12daea Action selection based on action descriptors 2014-02-17 22:42:02 -08:00
Yishai Galatzer 90daa2587d Minor cleanup 2014-02-15 10:21:27 -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
Pranav K 5a22d9b52c Restore @model support in RazorHost 2014-02-13 12:48:02 -08:00
Ryan Nowak 4a801b6c7a integrating routing with WebFX 2014-02-12 18:48:17 -08:00
Yishai Galatzer cc3fec2f76 Bring back simple POCO controller
+ HttpContext temporary injection through property
+ 404 when action is not found
2014-02-11 17:25:30 -08:00
Yishai Galatzer 400240673b Update to CR feedback 2014-02-10 13:29:46 -08:00
Yishai Galatzer a725e4c9b5 Update to support 404
Renamed actiondescriptor to routecontext, because action selection didn't happen yet.
Need to add actiondescriptors back and modify RazorViewEngine to use the right thing.
2014-02-10 13:24:45 -08:00
Yishai Galatzer b6a0969c1c Support per process caching of controller discovery
Scan only relevant (non skipped) assemblies
FinalizeSetup point, to make "stuff" immutable
Support controllers under any namespace
support customizing controller discovery
support customizing skipped assemblies
support customizing multiple controllers with the same name under different namespaces and assemblies
support controller ambiguity detection
2014-02-10 13:24:44 -08:00
Pranav K 3d6740bc8a Update namespace generation in RazorCompilationService to use root
relative paths.
2014-02-07 13:55:59 -08:00
Pranav K 591e21eea9 Moving MvcService and MvcHandler to a separate assembly
Tenatively named Microsoft.AspNet.Mvc.Startup, the assembly will act as an
entry point into the Mvc handler \ middleware.
2014-02-06 16:21:14 -08:00
Pranav K 6c8485b1ef Removing VirtualFileSystem from Razor
* Paths rooted by a leading slash (e.g. /foo) are correctly resolved by the
PhysicalFileSystem. This change is an experiment to determine if we can
get away with not having virtual paths in WebFx.

* Additionally removing types (MetadataVirtualPathViewFactory,
 VirtualPathAttribute) that are currently unused.
2014-02-04 22:08:27 -08:00
Yishai Galatzer 764e5f890d Use Json result constructor only from the Action result helper.
Names to be changed, as they don't make much sense at the moment. Keeping them the same for diffing purposes
2014-02-04 13:54:22 -08:00
Yishai Galatzer 312b4c5fb5 sort usings 2014-02-04 13:54:21 -08:00
Yishai Galatzer 2a3f891878 Customizing Json from helper
Add Json to Helper
Guarantee SerializerSettings
2014-02-04 13:54:20 -08:00
Yishai Galatzer 4b4034788c Initial support for JsonResult + Action result mutation from object to Json 2014-02-04 13:54:19 -08:00
Pranav K c91a814ffa Changes to get the sample running again 2014-02-03 21:05:54 -08:00
David Fowler f26b3743ec Updated logic to use new HttpAbstractions.
- Updated sln files to use k10 and net45 solution folders
2014-02-01 01:59:30 -08:00
David Fowler ebbb481fea Print hello world for k10 project. 2014-02-01 00:39:26 -08:00
Pranav K cc414e0fef * Renaming Mvc.Forms to Mvc.Rendering
* Moving data types to Mvc.ModelBinding
2014-01-30 16:45:40 -08:00
Pranav K 6c9d562fc3 * Using RazorView<dynamic> as base type until we get model support
* Modifying ViewData to share inner dictionary until we figure out how to
  pass it correctly
* Removing unused NuGet.config
2014-01-30 07:26:46 -08:00
Pranav K 85a25685d2 Changes to let Net45 sample run over Owin 2014-01-29 20:29:21 -08:00
Pranav K a6393e77ab Moving MvcRazorHost to a separate assembly 2014-01-29 15:20:48 -08:00
Pranav K afa22994bf Fixing project.json schemas 2014-01-25 23:57:22 -08:00
David Fowler f36aa5ba3c Fixed up project.json to be more specific. 2014-01-25 22:16:30 -08:00
David Fowler 127b6886c4 Removed the generated csprojes 2014-01-25 17:16:00 -08:00
David Fowler 328d43a638 Updated the sample to use the owin http abstractions glue. 2014-01-25 16:44:35 -08:00
David Fowler 2bd1aab88d Updated the samples project for net45 to use owin. 2014-01-25 16:04:50 -08:00
David Fowler 1d27b4e2e4 Remove packages.config 2014-01-25 15:16:24 -08:00
David Fowler a0de7048b5 Ifdef to make stuff compile on both platforms. 2014-01-24 02:20:46 -08:00
David Fowler b0933fdd35 Updated the build and removed older projects. 2014-01-24 02:02:47 -08:00
David Fowler b54a0da6e8 Updated MVC.
- Use new HttpAbstractions
- Updated the build
- Added new projects
2014-01-24 01:55:17 -08:00
David Fowler 477cf79e58 Removed unneeded dependencies and updated owin bits. 2014-01-22 19:03:56 -08:00
Pranav K df5a6d30d6 * Migrating HtmlHelper stub
* Updating project json files to new format
2014-01-22 12:27:24 -08:00
Pranav K 69a99e5c41 Moving View overloads to Controller base type 2014-01-22 10:59:32 -08:00
Pranav K 7b8a54cc24 * Updating project structure to use the src, test, build, samples format
* Adding build scripts to use K compilation.
2014-01-21 16:15:44 -08:00