Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 cleanup: Remove the obsolete context.IsPostback setter #1899

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/Framework/Framework/Hosting/DotvvmRequestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,12 @@ public class DotvvmRequestContext : IDotvvmRequestContext
/// <summary>
/// Determines whether this HTTP request is a postback or a classic GET request.
/// </summary>
public bool IsPostBack
{
get => RequestType == DotvvmRequestType.Command;
set
{
// TODO: remove this setter
if (value) RequestType = DotvvmRequestType.Command;
else if (RequestType == DotvvmRequestType.Command) RequestType = DotvvmRequestType.Navigate;
}
}
public bool IsPostBack => RequestType == DotvvmRequestType.Command;

/// <summary>
/// Determines type of the request - initial GET, command, staticCommand, ...
/// </summary>
public DotvvmRequestType RequestType { get; private set; }
public DotvvmRequestType RequestType { get; }

/// <summary>
/// Gets the view model object for the current HTTP request.
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Framework/Hosting/IDotvvmRequestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface IDotvvmRequestContext
/// <summary>
/// Determines whether this HTTP request is a command executing POST request.
/// </summary>
bool IsPostBack { get; set; }
bool IsPostBack { get; }

/// <summary>
/// Determines type of the request - initial GET, command, staticCommand, ...
Expand Down
6 changes: 1 addition & 5 deletions src/Framework/Framework/Testing/TestDotvvmRequestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ public class TestDotvvmRequestContext : IDotvvmRequestContext
public DotvvmConfiguration Configuration { get; set; }
public IDotvvmPresenter Presenter { get; set; }
public RouteBase Route { get; set; }
public bool IsPostBack
{
get => RequestType == DotvvmRequestType.Command;
[Obsolete("Don't do this", true)] set { }
}
public bool IsPostBack => RequestType == DotvvmRequestType.Command;
public DotvvmRequestType RequestType { get; set; } = DotvvmRequestType.Navigate;
public IDictionary<string, object> Parameters { get; set; }
public ResourceManager ResourceManager { get; set; }
Expand Down
Loading