Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Define crisp for semantics for what makes a pagemodel a pagemodel #6210

Closed
rynowak opened this issue Apr 26, 2017 · 2 comments
Closed

Define crisp for semantics for what makes a pagemodel a pagemodel #6210

rynowak opened this issue Apr 26, 2017 · 2 comments

Comments

@rynowak
Copy link
Member

rynowak commented Apr 26, 2017

Consider the following:

public class MyModel
{
    [FromRoute]
    public int Value { get; set; }
}
@page
@model MyModel

@functions {
    public Task OnPostAsync(...) { ... } // Should this run?
}

Right now the decision depends on whether or not MyModel has a handler method. This is kinda haphazard 😞

We need to define this semantic clearly.

Idea:

  • Naming convention based on *Model naming
  • An attribute for a base class that says "all derived classes are pagemodels"
  • Put that attribute on PageModel.

This is pretty similar to what we do for controllers and VCs

@rynowak rynowak added this to the 2.0.0-preview2 milestone Apr 26, 2017
@rynowak
Copy link
Member Author

rynowak commented May 19, 2017

No one has complained.. Let's move this to preview3

@rynowak rynowak modified the milestones: 2.0.0-preview3, 2.0.0-preview2 May 19, 2017
@rynowak rynowak self-assigned this May 19, 2017
@Eilon
Copy link
Member

Eilon commented Jun 9, 2017

Discussed with @rynowak and we think that we should drop the naming convention for now.

We should just use the attribute, or any base class that has the attribute.

rynowak added a commit that referenced this issue Jun 28, 2017
Now a pagemodel requires a [PageModel] somewhere in it's hierarchy. We
don't do a guess at whether or not your model class is a PageModel.
pranavkm pushed a commit that referenced this issue Jun 29, 2017
Fixes #6210

Now a pagemodel requires a [PageModel] somewhere in it's hierarchy. We
don't do a guess at whether or not your model class is a PageModel.
@pranavkm pranavkm assigned pranavkm and unassigned rynowak Jun 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants