Created
June 21, 2015 14:00
-
-
Save aw3s0me/8edf744c1a3d9f17f995 to your computer and use it in GitHub Desktop.
json orm int
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 characters
| using Newtonsoft.Json.Linq; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace jsonorm | |
| { | |
| public class LocalStorage<T> where T : new() | |
| { | |
| protected ISession session | |
| { | |
| get | |
| { | |
| return JsonUtils.Instance; | |
| } | |
| } | |
| //protected string ServiceEndPoint { get; set; } | |
| public void Save(T entity, string entityname) | |
| { | |
| session.Save<T>(entity, entityname); | |
| } | |
| public void Save(string entity, string entityname) | |
| { | |
| T tentity = Commons.Instance.DeserializeObject<T>(entity); | |
| session.Save<T>(tentity, entityname); | |
| } | |
| public void SaveOrUpdate(T entity, Func<T, bool> query, string entityname) | |
| { | |
| session.SaveOrUpdate<T>(entity, query, entityname); | |
| } | |
| public T GetElementById(Func<T, bool> query, string entityname) | |
| { | |
| return session.GetElementById<T>(query, entityname); | |
| } | |
| public List<T> GetElementList(string entityname) | |
| { | |
| return session.GetElementList<T>(entityname); | |
| } | |
| public List<T> GetElementList(Func<T, bool> query, string entityname) | |
| { | |
| return session.GetElementList<T>(query, entityname); | |
| } | |
| } | |
| public class NotifyContainerUpdates | |
| { | |
| public NotifyContainerUpdates() | |
| { | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment