[ https://issues.apache.org/jira/browse/GEODE-9464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17404780#comment-17404780 ]
ASF GitHub Bot commented on GEODE-9464: --------------------------------------- pivotal-jbarrett commented on a change in pull request #856: URL: https://github.com/apache/geode-native/pull/856#discussion_r696182426 ########## File path: netcore/AspNetCore GeodeSession Sample/Extensions/SessionExtensions.cs ########## @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System.Text.Json; +using Microsoft.AspNetCore.Http; + +namespace Web.Extensions { +#region snippet1 + public static class SessionExtensions { + public static void Set<T>(this ISession session, string key, T value) { + session.SetString(key, JsonSerializer.Serialize(value)); + } + + public static T Get<T>(this ISession session, string key) { + var value = session.GetString(key); + return value == null ? default : JsonSerializer.Deserialize<T>(value); + } + } +#endregion +} + +namespace Web.Extensions2 { + // Alternate approach + + public static class SessionExtensions { + public static void Set<T>(this ISession session, string key, T value) { + session.SetString(key, JsonSerializer.Serialize(value)); + } + + public static bool TryGet<T>(this ISession session, string key, out T value) { + var state = session.GetString(key); + value = default; + if (state == null) Review comment: Always use `{}` braces. ########## File path: netcore/AspNetCore GeodeSession Sample/AspNetCore GeodeSession Sample.csproj.user ########## @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ActiveDebugProfile>IIS Express</ActiveDebugProfile> + </PropertyGroup> +</Project> Review comment: New line ########## File path: netcore/AspNetCore GeodeSession Sample/Models/BasicAuthInitialize.cs ########## @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using Apache.Geode.Client; +using System; +using System.Collections.Generic; + +namespace GemFireSessionState.Models +{ + public class BasicAuthInitialize : IAuthInitialize + { + private string _username; + private string _password; + + public BasicAuthInitialize(string username, string password) + { + _username = username; + _password = password; + } + + public void Close() + { + } + + public Dictionary<string, string> GetCredentials() + { + Console.WriteLine("SimpleAuthInitialize::GetCredentials called"); + var credentials = new Dictionary<string, string>(); + credentials.Add("security-username", "root"); + credentials.Add("security-password", "root-password"); + return credentials; + } + } +} Review comment: New line -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add a non-Steeltoe Asp.Net Core SessionState sample app to SessionStateCore > --------------------------------------------------------------------------- > > Key: GEODE-9464 > URL: https://issues.apache.org/jira/browse/GEODE-9464 > Project: Geode > Issue Type: Test > Components: native client > Reporter: Michael Martell > Priority: Major > Labels: pull-request-available > > The current Asp.Net sample app uses Steeltoe for discovery and registration > of our sessionstate provider. We need a non-Steeltoe sample as well, since > not everyone uses Steeltoe. > This will be a good test of our NuGet access to the SessionState Core > artifacts and its dependencies. > Note: Ensure that the web application runs on all platforms. -- This message was sent by Atlassian Jira (v8.3.4#803005)