Skip to content

Commit 4eabe42

Browse files
committed
Добавлен конструктор для CookieOptionsWrapper.cs
1 parent 2bf95ec commit 4eabe42

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/OneScript.Web.Server/CookieOptionsWrapper.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public IValue Expires
7070
}
7171

7272
[ContextProperty("Безопасный", "Secure")]
73-
public IValue Secure
73+
public bool Secure
7474
{
75-
get => BslBooleanValue.Create(_cookieOptions.Secure);
76-
set => _cookieOptions.Secure = value.AsBoolean();
75+
get => _cookieOptions.Secure;
76+
set => _cookieOptions.Secure = value;
7777
}
7878

7979
[ContextProperty("РежимSameSite", "SameSiteMode")]
@@ -84,10 +84,10 @@ public SameSiteModeEnum SameSiteMode
8484
}
8585

8686
[ContextProperty("ТолькоHttp", "HttpOnly")]
87-
public IValue HttpOnly
87+
public bool HttpOnly
8888
{
89-
get => BslBooleanValue.Create(_cookieOptions.HttpOnly);
90-
set => _cookieOptions.HttpOnly = value.AsBoolean();
89+
get => _cookieOptions.HttpOnly;
90+
set => _cookieOptions.HttpOnly = value;
9191
}
9292

9393
[ContextProperty("МаксимальныйВозраст", "MaxAge")]
@@ -110,10 +110,16 @@ public IValue MaxAge
110110
}
111111

112112
[ContextProperty("Важный", "IsEssential")]
113-
public IValue IsEssential
113+
public bool IsEssential
114114
{
115-
get => BslBooleanValue.Create(_cookieOptions.IsEssential);
116-
set => _cookieOptions.IsEssential = value.AsBoolean();
115+
get => _cookieOptions.IsEssential;
116+
set => _cookieOptions.IsEssential = value;
117+
}
118+
119+
[ScriptConstructor]
120+
public static CookieOptionsWrapper Create()
121+
{
122+
return new CookieOptionsWrapper();
117123
}
118124
}
119125
}

0 commit comments

Comments
 (0)