Created
June 26, 2012 00:24
Revisions
-
glikoz revised this gist
Jun 26, 2012 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,9 +16,21 @@ public static T Get<T>(this UserAuth userAuth) return str == null ? default(T) : TypeSerializer.DeserializeFromString<T>(str); } public static T Get<T>(this UserAuth userAuth, string field) { string str; userAuth.Meta.TryGetValue(field, out str); return str == null ? default(T) : TypeSerializer.DeserializeFromString<T>(str); } public static void Set<T>(this UserAuth userAuth, T value) { userAuth.Meta[typeof(T).Name] = TypeSerializer.SerializeToString(value); } public static void Set<T>(this UserAuth userAuth,string field,T value) { userAuth.Meta[field] = TypeSerializer.SerializeToString(value); } } } -
glikoz revised this gist
Jun 26, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,14 +9,14 @@ namespace ServiceStack.ServiceInterface.Auth { public static class UserAuthExtensions { public static T Get<T>(this UserAuth userAuth) { string str; userAuth.Meta.TryGetValue(typeof(T).Name, out str); return str == null ? default(T) : TypeSerializer.DeserializeFromString<T>(str); } public static void Set<T>(this UserAuth userAuth, T value) { userAuth.Meta[typeof(T).Name] = TypeSerializer.SerializeToString(value); } -
glikoz created this gist
Jun 26, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using ServiceStack.ServiceInterface.Auth; using ServiceStack.Text; namespace ServiceStack.ServiceInterface.Auth { public static class UserAuthExtensions { public T Get<T>(this UserAuth userAuth) { string str; userAuth.Meta.TryGetValue(typeof(T).Name, out str); return str == null ? default(T) : TypeSerializer.DeserializeFromString<T>(str); } public void Set<T>(this UserAuth userAuth, T value) { userAuth.Meta[typeof(T).Name] = TypeSerializer.SerializeToString(value); } } }